Skip to content

Commit d23e757

Browse files
icomfortgitster
authored andcommitted
bash: complete *_HEAD refs if present
We already complete HEAD, of course, and might as well complete the other common refs mentioned in the rev-parse man page: FETCH_HEAD, ORIG_HEAD, and MERGE_HEAD. Signed-off-by: Ian Ward Comfort <[email protected]> Acked-by: Shawn O. Pearce <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7325283 commit d23e757

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

contrib/completion/git-completion.bash

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@ __git_refs ()
250250
refs="${cur%/*}"
251251
;;
252252
*)
253-
if [ -e "$dir/HEAD" ]; then echo HEAD; fi
253+
for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do
254+
if [ -e "$dir/$i" ]; then echo $i; fi
255+
done
254256
format="refname:short"
255257
refs="refs/tags refs/heads refs/remotes"
256258
;;

0 commit comments

Comments
 (0)