summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2008-07-14 00:22:03 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-07-14 00:27:50 (GMT)
commit778306e405b416d8073652c535777f2de5fc68ad (patch)
tree973997dde7a1864edcb1cb607229532184bd847c /contrib
parent6c36c9e4eabadecf75f8751b1c1140da2068e2a0 (diff)
downloadgit-778306e405b416d8073652c535777f2de5fc68ad.zip
git-778306e405b416d8073652c535777f2de5fc68ad.tar.gz
git-778306e405b416d8073652c535777f2de5fc68ad.tar.bz2
bash completion: Append space after file names have been completed
When completing `git show origin/maint:Makef<tab>` we should add a space after the filename has been completed, so that the user can immediately begin the next argument. I also added a special case for the symlink variant so we treat it just like a normal blob, as there are no items below it in the Git tree structure. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/completion/git-completion.bash10
1 files changed, 9 insertions, 1 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 821c9a7..0a3bea4 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -294,9 +294,17 @@ __git_complete_file ()
ls="$ref"
;;
esac
+ local IFS=$'\n'
COMPREPLY=($(compgen -P "$pfx" \
-W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
- | sed '/^100... blob /s,^.* ,,
+ | sed '/^100... blob /{
+ s,^.* ,,
+ s,$, ,
+ }
+ /^120000 blob /{
+ s,^.* ,,
+ s,$, ,
+ }
/^040000 tree /{
s,^.* ,,
s,$,/,