Skip to content

Commit

Permalink
Revert "Support git safe directory for manifest in subdirectory"
Browse files Browse the repository at this point in the history
This reverts commit 7d6496d.

As described in
#395 we
cannot use `git rev-parse --show-toplevel` to find the root directory of
the repository in order to mark it as safe – because `git` refuses to
operate on a directory with dubious ownership, which is what we are
trying to fix!

We will need an alternative solution but for the meantime, revert this
change to fix the common case where the manifest is in the root
directory.
  • Loading branch information
wjt committed Nov 9, 2023
1 parent 83e538e commit 7ac9005
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,6 @@ def check_call(args):
subprocess.check_call(args)


def get_manifest_git_checkout(manifest: t.Union[Path, str]) -> str:
manifest_dir = os.path.dirname(manifest)
output = subprocess.check_output(
["git", "rev-parse", "--show-toplevel"],
cwd=manifest_dir,
)
return output.decode("utf-8").strip()


def ensure_git_safe_directory(checkout: t.Union[Path, str]):
uid = os.getuid()
checkout_uid = os.stat(checkout).st_uid
Expand Down Expand Up @@ -460,7 +451,7 @@ async def run_with_args(args: argparse.Namespace) -> t.Tuple[int, int, bool]:
if should_update and outdated_num > 0:
changes = manifest_checker.update_manifests()
if changes and not args.edit_only:
git_checkout = get_manifest_git_checkout(args.manifest)
git_checkout = os.path.dirname(args.manifest)
ensure_git_safe_directory(git_checkout)
with indir(git_checkout):
committed_changes = commit_changes(changes)
Expand Down

0 comments on commit 7ac9005

Please sign in to comment.