[gclient] Reset to parent commit with rebase_patch_ref=False instead of master.
This makes no-rebase-patch-ref correctly populate `file_list` and work with
`git diff --cached` (i.e. they will show only the files affected by the
patchset).
Previously gclient would `reset --soft` to master. Because we didn't rebase
on top of master with `no-rebase-patch-ref`, it has roughly nothing to do
with the patchref we just checked out.
R=gbeaty@chromium.org, ltina@google.com, tandrii@chromium.org
Context:
Tricium recipes sometimes need to use no-rebase-patch-ref in order to get
accurate linenumbers in the diff (i.e. so that the tricium comments will
actually line up correctly with the patchset the user uploaded); Tricium
recipes also need to accurately get the diff file list in this mode.
Change-Id: I5f3c95cd4958cf407a83b96c238b8c55c452ac81
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1895041
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
Commit-Queue: Andrii Shyshkalov <tandrii@google.com>
diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py
index 9b53902..f7490e1 100755
--- a/tests/gclient_scm_test.py
+++ b/tests/gclient_scm_test.py
@@ -1217,7 +1217,7 @@
file_list)
self.assertCommits([1, 2, 3, 5, 6])
- self.assertEqual(self.githash('repo_1', 4), self.gitrevparse(self.root_dir))
+ self.assertEqual(self.githash('repo_1', 5), self.gitrevparse(self.root_dir))
def testDoesntRebasePatchOldCheckout(self):
"""Tests that we can apply a patch without rebasing it on an old checkout.
@@ -1237,7 +1237,7 @@
file_list)
self.assertCommits([1, 2, 3, 5, 6])
- self.assertEqual(self.githash('repo_1', 1), self.gitrevparse(self.root_dir))
+ self.assertEqual(self.githash('repo_1', 5), self.gitrevparse(self.root_dir))
def testDoesntSoftResetIfNotAskedTo(self):
"""Test that we can apply a patch without doing a soft reset."""