git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bash completion: Append space after file names have been completed
@ 2008-07-14  0:22 Shawn O. Pearce
  0 siblings, 0 replies; only message in thread
From: Shawn O. Pearce @ 2008-07-14  0:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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>
---
 contrib/completion/git-completion.bash |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 9a1c66a..790d1c6 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,$,/,
-- 
1.5.6.2.393.g45096

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-07-14  0:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-14  0:22 [PATCH] bash completion: Append space after file names have been completed Shawn O. Pearce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).