mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-01-20 16:14:25 +00:00
sync: add sanity check for local checkouts missing network
If you run `repo sync -l foo` without first `repo sync -n foo`, repo sets up an invalid gitdir tree that gets wedged and requires manual recovery. Add a sanity check to abort cleanly first. Change-Id: Iad865ea860a3f1fd2f39ce683fe66bd4380745a5 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/244732 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
dff919493a
commit
b610b850ac
@ -1499,6 +1499,13 @@ class Project(object):
|
|||||||
"""Perform only the local IO portion of the sync process.
|
"""Perform only the local IO portion of the sync process.
|
||||||
Network access is not required.
|
Network access is not required.
|
||||||
"""
|
"""
|
||||||
|
if not os.path.exists(self.gitdir):
|
||||||
|
syncbuf.fail(self,
|
||||||
|
'Cannot checkout %s due to missing network sync; Run '
|
||||||
|
'`repo sync -n %s` first.' %
|
||||||
|
(self.name, self.name))
|
||||||
|
return
|
||||||
|
|
||||||
self._InitWorkTree(force_sync=force_sync, submodules=submodules)
|
self._InitWorkTree(force_sync=force_sync, submodules=submodules)
|
||||||
all_refs = self.bare_ref.all
|
all_refs = self.bare_ref.all
|
||||||
self.CleanPublishedCache(all_refs)
|
self.CleanPublishedCache(all_refs)
|
||||||
|
Loading…
Reference in New Issue
Block a user