From 2f0147a57a86a530f9e092d626da75286cbb6961 Mon Sep 17 00:00:00 2001 From: Robert Iannucci Date: Thu, 20 Jul 2023 16:41:59 +0000 Subject: [PATCH] [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 Reviewed-by: Andy Perelson Auto-Submit: Robbie Iannucci --- git_common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/git_common.py b/git_common.py index 83092258d6..925f2cd91c 100644 --- a/git_common.py +++ b/git_common.py @@ -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