【发布时间】:2020-10-14 11:07:51
【问题描述】:
我正在尝试使用repo 进行测试,但它似乎对我来说效果不佳。如果我运行repo init -u https://android.googlesource.com/platform/manifest,则会得到以下输出:
[localhost] 10:03 $ REPO_TRACE=1 repo init -u https://android.googlesource.com/platform/manifest
: python3.6 /home/simonrose/bin/repo init -u https://android.googlesource.com/platform/manifest
: git --version
Downloading Repo source from https://gerrit.googlesource.com/git-repo
: git init --quiet
: git config remote.origin.url https://gerrit.googlesource.com/git-repo
: git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
: git config --get-regexp url.*.insteadof
: git fetch --quiet /home/simonrose/data/git/repo-test/.repo/repo/.git/clone.bundle +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/*
: git fetch --quiet --progress origin +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/*
: git rev-parse --verify refs/remotes/origin/stable^{commit}
: git describe 60fc51bb1dcf8970189a544c2ca75f2cdcfdb6f8
: git tag -v v2.8
: git update-ref refs/heads/default v2.8^0
: git config branch.default.remote origin
: git config branch.default.merge refs/heads/stable
: git symbolic-ref HEAD refs/heads/default
: git read-tree --reset -u -v HEAD
: /usr/bin/python3.6 /home/simonrose/data/git/repo-test/.repo/repo/main.py --repo-dir=/home/simonrose/data/git/repo-test/.repo --wrapper-version=2.8 --wrapper-path=/home/simonrose/bin/repo -- init -u https://android.googlesource.com/platform/manifest
: git --version
: parsing /home/simonrose/.gitconfig
Downloading manifest from https://android.googlesource.com/platform/manifest
: export GIT_DIR=/home/simonrose/data/git/repo-test/.repo/manifests.git
: git init 1>| 2>|
: git config --file /home/simonrose/data/git/repo-test/.repo/manifests.git/config --includes --null --list 1>| 2>|
: git config --file /home/simonrose/data/git/repo-test/.repo/manifests.git/config --includes --replace-all filter.lfs.smudge git-lfs smudge --skip -- %f 1>| 2>|
: git config --file /home/simonrose/data/git/repo-test/.repo/manifests.git/config --includes --replace-all filter.lfs.process git-lfs filter-process --skip 1>| 2>|
: git config --file /home/simonrose/data/git/repo-test/.repo/manifests.git/config --includes --unset-all core.bare 1>| 2>|
: git config --file /home/simonrose/data/git/repo-test/.repo/manifests.git/config --includes --replace-all remote.origin.url https://android.googlesource.com/platform/manifest 1>| 2>|
: git config --file /home/simonrose/data/git/repo-test/.repo/manifests.git/config --includes --replace-all remote.origin.fetch +refs/heads/*:refs/remotes/origin/* 1>| 2>|
curl --fail --output /home/simonrose/data/git/repo-test/.repo/manifests.git/clone.bundle.tmp --netrc --location https://android.googlesource.com/platform/manifest/clone.bundle
: git fetch --quiet --progress /home/simonrose/data/git/repo-test/.repo/manifests.git/clone.bundle +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/* 1>| 2>|
Receiving objects: 100% (78461/78461), 58.02 MiB | 25.86 MiB/s, done.
Resolving deltas: 100% (23276/23276), done.
: git fetch --quiet --progress origin --tags +refs/heads/*:refs/remotes/origin/* +refs/heads/master:refs/remotes/origin/master +refs/tags/*:refs/tags/* 1>| 2>&1
remote: Counting objects: 2, done
remote: Finding sources: 100% (119/119)
remote: Total 119 (delta 35), reused 110 (delta 35)
Receiving objects: 100% (119/119), 418.92 KiB | 906.00 KiB/s, done.
Resolving deltas: 100% (35/35), completed with 11 local objects.
: git rev-parse --verify refs/remotes/origin/master^0 1>| 2>|
: cd /home/simonrose/data/git/repo-test/.repo/manifests
: git read-tree --reset -u -v HEAD 1>| 2>|
fatal: not a git repository (or any parent up to mount point /home/simonrose)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Traceback (most recent call last):
File "/home/simonrose/data/git/repo-test/.repo/repo/main.py", line 628, in <module>
_Main(sys.argv[1:])
File "/home/simonrose/data/git/repo-test/.repo/repo/main.py", line 602, in _Main
result = run()
File "/home/simonrose/data/git/repo-test/.repo/repo/main.py", line 595, in <lambda>
run = lambda: repo._Run(name, gopts, argv) or 0
File "/home/simonrose/data/git/repo-test/.repo/repo/main.py", line 264, in _Run
result = cmd.Execute(copts, cargs)
File "/home/simonrose/data/git/repo-test/.repo/repo/subcmds/init.py", line 524, in Execute
self._SyncManifest(opt)
File "/home/simonrose/data/git/repo-test/.repo/repo/subcmds/init.py", line 334, in _SyncManifest
m.Sync_LocalHalf(syncbuf, submodules=opt.submodules)
File "/home/simonrose/data/git/repo-test/.repo/repo/project.py", line 1623, in Sync_LocalHalf
self._InitWorkTree(force_sync=force_sync, submodules=submodules)
File "/home/simonrose/data/git/repo-test/.repo/repo/project.py", line 3135, in _InitWorkTree
raise GitError('Cannot initialize work tree for ' + self.name)
error.GitError: Cannot initialize work tree for manifests
我可以看到似乎有问题的行:
fatal: not a git repository (or any parent up to mount point /home/simonrose)
但是,如果我切换到目录.repo/manifests,它是一个 git 存储库,但由于某种原因,所有文件都被删除了。
如果我运行repo --version,那么我会得到以下信息:
[localhost] 10:08 $ repo --version
repo version v2.8
(from https://gerrit.googlesource.com/git-repo)
(Thu, 21 May 2020 22:46:11 +0000)
repo launcher version 2.8
(from /home/simonrose/bin/repo)
(currently at 2.8)
repo User-Agent git-repo/2.8 (Linux) git/2.24.2 Python/3.6.8
git 2.24.2
git User-Agent git/2.24.2 (Linux) git-repo/2.8
Python 3.6.8 (default, Aug 7 2019, 17:28:10)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
OS Linux 3.10.0-1062.9.1.el7.x86_64 (#1 SMP Fri Dec 6 15:49:49 UTC 2019)
CPU x86_64 (x86_64)
那是什么?这似乎是一种非常奇怪的行为,repo 给出了一个错误并且只对存储库进行了部分初始化。
(我也用 python 2.7.5 测试过这个,我得到了同样的错误)
后记:
请注意,如果我在出现此错误后重新运行 repo init,则会收到错误消息
[localhost] 10:08 $ repo init
fatal: manifest 'default.xml' not available
fatal: manifest default.xml not found
如果我随后进入 .repo/manifests 并取消删除(即取消暂存和签出)default.xml,那么 repo init 就可以正常工作。但是,repo sync 在签出存储库时会遇到类似的问题...
【问题讨论】:
-
我也面临类似的问题,当我执行 'repo init -u
-b 时,出现类似的错误。在网络上尝试了不同的解决方案,但没有任何效果。