login
Header Space

 
 

[PATCH] bash: Add completion for gitk --merge

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git@...>
Cc: Richard Quirk <richard.quirk@...>
Date: Saturday, April 26, 2008 - 7:32 pm

Option is only completed when .git/MERGE_HEAD is present.

Signed-off-by: Richard Quirk <richard.quirk@gmail.com>
---
 contrib/completion/git-completion.bash |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 665a895..2565aa6 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1346,9 +1346,14 @@ _git ()
 _gitk ()
 {
 	local cur="${COMP_WORDS[COMP_CWORD]}"
+	local g="$(git rev-parse --git-dir 2>/dev/null)"
+	local merge=""
+	if [ -f $g/MERGE_HEAD ]; then
+		local merge="--merge"
+	fi
 	case "$cur" in
 	--*)
-		__gitcomp "--not --all"
+		__gitcomp "--not --all $merge"
 		return
 		;;
 	esac
-- 
1.5.5.1.79.g57cf

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] bash: Add completion for gitk --merge, Richard Quirk, (Sat Apr 26, 7:32 pm)
Re: [PATCH] bash: Add completion for gitk --merge, Shawn O. Pearce, (Sun Apr 27, 12:18 am)
[PATCH] bash: Add completion for gitk --merge, Richard Quirk, (Sun Apr 27, 11:35 am)
Re: [PATCH] bash: Add completion for gitk --merge, Shawn O. Pearce, (Sun Apr 27, 1:19 pm)
speck-geostationary