mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Update _CheckForImmutableRevision to use git rev-list
_CheckForImmutableRevision is used to see if repo can skip fetching a project, but 'git rev-parse' with partial clone does a data fetch to accomplish this. Changed to use: 'git rev-list -1 --missing=allow-any <SHA>^0' which checks the local ref without fetching from the server first. Bug: [google internal] b/179477822 Testing: - Unit tests - Verified init/sync working on aosp-master - Verified wwith a pinned manifest that local ref check works (no fetch) Change-Id: If327b893c6658421f41df1f58c337f53b4c60ce6 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/296142 Reviewed-by: Dan Willemsen <dwillemsen@google.com> Tested-by: Ian Kasprzak <iankaz@google.com>
This commit is contained in:
parent
ef267722f8
commit
0286e31ec7
@ -438,6 +438,7 @@ class RemoteSpec(object):
|
||||
self.orig_name = orig_name
|
||||
self.fetchUrl = fetchUrl
|
||||
|
||||
|
||||
class Project(object):
|
||||
# These objects can be shared between several working trees.
|
||||
shareable_files = ['description', 'info']
|
||||
@ -1927,7 +1928,8 @@ class Project(object):
|
||||
try:
|
||||
# if revision (sha or tag) is not present then following function
|
||||
# throws an error.
|
||||
self.bare_git.rev_parse('--verify', '%s^0' % self.revisionExpr)
|
||||
self.bare_git.rev_list('-1', '--missing=allow-any',
|
||||
'%s^0' % self.revisionExpr, '--')
|
||||
return True
|
||||
except GitError:
|
||||
# There is no such persistent revision. We have to fetch it.
|
||||
|
Loading…
Reference in New Issue
Block a user