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>
Shawn O. Pearce committed
Jul 14, 2008 at 00:22 UTC
778306e405b416d8073652c535777f2de5fc68ad
1 file changed
+9
-1
contrib/completion/git-completion.bash
+9
-1
@@ -294,9 +294,17 @@ __git_complete_file ()
294
ls="$ref"
295
;;
296
esac
297
+ local IFS=$'\n'
298
COMPREPLY=($(compgen -P "$pfx" \
299
-W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
299
- | sed '/^100... blob /s,^.* ,,
300
+ | sed '/^100... blob /{
301
+ s,^.* ,,
302
+ s,$, ,
303
+ }
304
+ /^120000 blob /{
305
+ s,^.* ,,
306
+ s,$, ,
307
+ }
308
/^040000 tree /{
309
s,^.* ,,
310
s,$,/,