Code

bash: complete *_HEAD refs if present
authorIan Ward Comfort <icomfort@stanford.edu>
Wed, 17 Mar 2010 09:20:35 +0000 (02:20 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 17 Mar 2010 18:03:44 +0000 (11:03 -0700)
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 <icomfort@stanford.edu>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash

index fe93747c93a7b65f4657b56ef3962d64b48e3eb7..733ac39a32f6fd0b4f1546d429ac55c4ad6699b6 100755 (executable)
@@ -250,7 +250,9 @@ __git_refs ()
                        refs="${cur%/*}"
                        ;;
                *)
-                       if [ -e "$dir/HEAD" ]; then echo HEAD; fi
+                       for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do
+                               if [ -e "$dir/$i" ]; then echo $i; fi
+                       done
                        format="refname:short"
                        refs="refs/tags refs/heads refs/remotes"
                        ;;