summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
authorConley Owens <cco3@android.com>2014-05-01 13:09:57 -0700
committerConley Owens <cco3@android.com>2014-05-01 13:20:32 -0700
commit666d534636d262cbfd971509dd0f0be0cddb2e11 (patch)
treef7341695337a3179d7c77c5fb1272d6e4f83f595 /project.py
parentf2af7564256a65221e0ebc45d716672a42cd537a (diff)
downloadgit-repo-666d534636d262cbfd971509dd0f0be0cddb2e11.tar.gz
Ensure HEAD is correct when skipping remote fetchv1.12.16
A recent optimization (2fb6466f795eb30c1dfa598501f5b5d2981e6a5f) skips performing a remote fetch if we already know we have the sha1 we want. However, that optimization skipped initialization steps that ensure HEAD points to the correct sha1. This change makes sure not to skip those steps. Here is an example of how to test this change: """"""""" url=<manifest url> branch1=<branch name> branch2=<branch name> project=<project with revision set to different sha1 in each branch> repo init -u $url -b $branch1 --mirror repo sync $project first=$(cd $project.git; git rev-parse HEAD) repo init -b $branch2 repo sync $project second=$(cd platform/build.git; git rev-parse HEAD) if [[ $first == $second ]] then echo 'problem!' else echo 'no problem!' fi """""""""
Diffstat (limited to 'project.py')
-rw-r--r--project.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/project.py b/project.py
index 22184578..127176e5 100644
--- a/project.py
+++ b/project.py
@@ -1103,17 +1103,12 @@ class Project(object):
1103 elif self.manifest.default.sync_c: 1103 elif self.manifest.default.sync_c:
1104 current_branch_only = True 1104 current_branch_only = True
1105 1105
1106 is_sha1 = False 1106 has_sha1 = ID_RE.match(self.revisionExpr) and self._CheckForSha1()
1107 if ID_RE.match(self.revisionExpr) is not None: 1107 if (not has_sha1 #Need to fetch since we don't already have this revision
1108 is_sha1 = True 1108 and not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir,
1109 if is_sha1 and self._CheckForSha1(): 1109 current_branch_only=current_branch_only,
1110 # Don't need to fetch since we already have this revision 1110 no_tags=no_tags)):
1111 return True 1111 return False
1112
1113 if not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir,
1114 current_branch_only=current_branch_only,
1115 no_tags=no_tags):
1116 return False
1117 1112
1118 if self.worktree: 1113 if self.worktree:
1119 self._InitMRef() 1114 self._InitMRef()