diff --git a/gclient_scm.py b/gclient_scm.py index a5dfbfcebf..982535d472 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -347,7 +347,8 @@ class GitWrapper(SCMWrapper): patch_repo, patch_ref, base_rev, self.checkout_path)) self._Capture(['reset', '--hard']) self._Capture(['fetch', patch_repo, patch_ref]) - file_list.extend(self._GetDiffFilenames('FETCH_HEAD')) + if file_list is not None: + file_list.extend(self._GetDiffFilenames('FETCH_HEAD')) self._Capture(['checkout', 'FETCH_HEAD']) if options.rebase_patch_ref: diff --git a/recipes/trigger_recipe_roller.txt b/recipes/trigger_recipe_roller.txt index 2ef8659ef6..b2d7da22bf 100644 --- a/recipes/trigger_recipe_roller.txt +++ b/recipes/trigger_recipe_roller.txt @@ -1,3 +1,4 @@ -No-op file. Edit this to kick recipes. Yep. Ack. +No-op file. Edit this to kick recipes. This is a beginning of a story in this silly file. +Once upon a time, diff --git a/tests/gclient_smoketest.py b/tests/gclient_smoketest.py index e6e6d6b95e..e836277907 100755 --- a/tests/gclient_smoketest.py +++ b/tests/gclient_smoketest.py @@ -536,7 +536,7 @@ class GClientSmokeGIT(GClientSmokeBase): tree['src/git_hooked2'] = 'git_hooked2' self.assertTree(tree) - def testSyncGerritRef(self): + def testSyncPatchRef(self): if not self.enabled: return self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) @@ -559,6 +559,28 @@ class GClientSmokeGIT(GClientSmokeBase): self.githash('repo_2', 1), self.gitrevparse(os.path.join(self.root_dir, 'src/repo2'))) + def testSyncPatchRefNoHooks(self): + if not self.enabled: + return + self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) + self.gclient([ + 'sync', '-v', '-v', '-v', + '--revision', 'src/repo2@%s' % self.githash('repo_2', 1), + '--patch-ref', + '%srepo_2@%s' % (self.git_base, self.githash('repo_2', 2)), + '--nohooks', + ]) + # Assert that repo_2 files coincide with revision @2 (the patch ref) + tree = self.mangle_git_tree(('repo_1@2', 'src'), + ('repo_2@2', 'src/repo2'), + ('repo_3@2', 'src/repo2/repo_renamed')) + self.assertTree(tree) + # Assert that HEAD revision of repo_2 is @1 (the base we synced to) since we + # should have done a soft reset. + self.assertEqual( + self.githash('repo_2', 1), + self.gitrevparse(os.path.join(self.root_dir, 'src/repo2'))) + def testRunHooks(self): if not self.enabled: return