From 7f95b88c669f684781cb34240fcbc71766d720de Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Wed, 15 May 2024 21:37:30 +0000 Subject: [PATCH] fail gracefully if git rename-branch is called in cog Bug: 339231299 Change-Id: If88eaa54c579b418516058b1285ce2eb5af6e474 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5540435 Auto-Submit: Yiwei Zhang Reviewed-by: Josip Sokcevic Commit-Queue: Josip Sokcevic --- git_rename_branch.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/git_rename_branch.py b/git_rename_branch.py index a600eb242..db46fd130 100755 --- a/git_rename_branch.py +++ b/git_rename_branch.py @@ -12,8 +12,14 @@ import subprocess2 from git_common import current_branch, run, set_branch_config, branch_config from git_common import branch_config_map +import gclient_utils + def main(args): + if gclient_utils.IsEnvCog(): + print('rename-branch command is not supported in non-git environment.', + file=sys.stderr) + return 1 current = current_branch() if current == 'HEAD': current = None