mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
upgrade-zulip-from-git: Fix fully broken refname parsing.
Commit c903128eb7
(#36214) was evidently
never tested.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
@@ -152,13 +152,12 @@ try:
|
||||
f"refs/tags/{refname}",
|
||||
f"refs/heads/{refname}" if args.local_ref else f"refs/remotes/origin/{refname}",
|
||||
]
|
||||
commit_hash: str | None = None
|
||||
fullref: str | None = None
|
||||
for ref in try_refs:
|
||||
result = subprocess.run(
|
||||
["git", "rev-parse", "--verify", ref],
|
||||
preexec_fn=su_to_zulip,
|
||||
text=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.DEVNULL,
|
||||
check=False,
|
||||
)
|
||||
@@ -168,13 +167,14 @@ try:
|
||||
break
|
||||
elif result.returncode != 128:
|
||||
result.check_returncode()
|
||||
if not commit_hash or not fullref:
|
||||
else:
|
||||
logging.error(
|
||||
"Failed to resolve %s as a tag or %s branch name!",
|
||||
refname,
|
||||
"local" if args.local_ref else "remote",
|
||||
)
|
||||
sys.exit(1)
|
||||
refname = fullref
|
||||
|
||||
subprocess.check_call(
|
||||
["git", "worktree", "add", "--detach", deploy_path, refname],
|
||||
|
Reference in New Issue
Block a user