[git-freeze] Fix error in git-add invocation when not in repo root.

The previous change to git-freeze added an accidental regression
where running `git freeze` from somewhere other than the repo root
would return a mysterious error:

  "Failed to index some unindexed files. Nothing to freeze."

This is because `git add` always treats pathspecs as relative to the
current working directory. Fix this by changing `git add` to always
run from the repo root.

R=ajp@google.com

Change-Id: I451f26fe35a5c6e9f3b917a1d90bdadc7065244c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4703128
Commit-Queue: Andy Perelson <ajp@google.com>
Reviewed-by: Andy Perelson <ajp@google.com>
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
changes/28/4703128/2
Robert Iannucci 2 years ago committed by LUCI CQ
parent fe5251af29
commit 2f0147a57a

@ -496,7 +496,8 @@ def freeze():
'--pathspec-from-file',
'-',
'--ignore-errors',
indata=b'\n'.join(unindexed))
indata=b'\n'.join(unindexed),
cwd=root_path)
except subprocess2.CalledProcessError:
add_errors = True

Loading…
Cancel
Save