From 4df79357994315d8d14ca9e44e126e64124135f3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 3 Dec 2021 10:59:05 +0530 Subject: [PATCH] Fix getting branch name not working if HEAD is also a tag --- setup/git_post_checkout_hook.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/git_post_checkout_hook.py b/setup/git_post_checkout_hook.py index 9b34c85783..606f59fedb 100755 --- a/setup/git_post_checkout_hook.py +++ b/setup/git_post_checkout_hook.py @@ -10,7 +10,7 @@ prev_rev, current_rev, flags = sys.argv[1:] def get_branch_name(rev): - return subprocess.check_output(['git', 'name-rev', '--name-only', rev]).decode('utf-8').strip() + return subprocess.check_output(['git', 'name-rev', '--name-only', '--refs=refs/heads/*', rev]).decode('utf-8').strip() base = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))