Hi,
We've encountered an error in repo on a few rare occasions when working with clone-depth=1 in our manifest.
I've been able to reproduce it on a certain production git, but have yet to produce a minimal test git with the problem.
A mock-up of the manifest contains the following:
<project clone-depth="1" groups="group" name="platform/some/name" path="some/name" revision="0123456789abcdef0123456789abcdef01234567" upstream="xyz/dev"/>
When performing repo sync here, we get stuck and python bails at stack depth 1000.
Exception RuntimeError: RuntimeError('maximum recursion depth exceeded',) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored
Exception in thread Thread-120:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 504, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/myname/somedir/.repo/repo/subcmds/sync.py", line 234, in _FetchProjectList
success = self._FetchHelper(opt, project, *args, **kwargs)
File "/home/myname/somedir/.repo/repo/subcmds/sync.py", line 275, in _FetchHelper
no_tags=opt.no_tags, archive=self.manifest.IsArchive)
File "/home/myname/somedir/.repo/repo/project.py", line 1114, in Sync_NetworkHalf
self._InitMRef()
File "/home/myname/somedir/.repo/repo/project.py", line 2148, in _InitMRef
self._InitAnyMRef(R_M + self.manifest.branch)
File "/home/myname/somedir/.repo/repo/project.py", line 2160, in _InitAnyMRef
self.bare_git.UpdateRef(ref, dst, message = msg, detach = True)
File "/home/myname/somedir/.repo/repo/project.py", line 2406, in UpdateRef
self.update_ref(*cmdv)
File "/home/myname/somedir/.repo/repo/project.py", line 2483, in runner
p.stderr))
GitError: platform/some/name update-ref: fatal: 0123456789abcdef0123456789abcdef01234567^0: not a valid SHA1
Stepping it through, I've reached the _RemoteFetch() in project.py, in the end of which we're doing the following:
if is_sha1 and current_branch_only and self.upstream:
# We just synced the upstream given branch; verify we
# got what we wanted, else trigger a second run of all
# refs.
if not self._CheckForSha1():
return self._RemoteFetch(name=name, current_branch_only=False,
initial=False, quiet=quiet, alt_dir=alt_dir)
However, _CheckForSha1() checks whether the sha1 is correct by trying to find its parent through "git-rev-parse --verify 0123456789abcdef0123456789abcdef01234567^0", which
will fail if the clone-depth is 1. In case of failure, we recurse with the same parameters as last time...
Do we need to add a special case here in case depth=1? Or is there something else that might be fishy?
We don't see this problem often, but it has happened occasionally.
Thankful for any advice on how to proceed!
Regards,
Felix