git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bash: Add completion for gitk --merge
@ 2008-04-26 23:32 Richard Quirk
  2008-04-27  4:18 ` Shawn O. Pearce
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Quirk @ 2008-04-26 23:32 UTC (permalink / raw)
  To: git; +Cc: Richard Quirk

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] bash: Add completion for gitk --merge
  2008-04-26 23:32 [PATCH] bash: Add completion for gitk --merge Richard Quirk
@ 2008-04-27  4:18 ` Shawn O. Pearce
  2008-04-27 15:35   ` Richard Quirk
  0 siblings, 1 reply; 4+ messages in thread
From: Shawn O. Pearce @ 2008-04-27  4:18 UTC (permalink / raw)
  To: Richard Quirk; +Cc: git

Richard Quirk <richard.quirk@gmail.com> wrote:
> 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(-)

Nice.
 
> 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"

I don't think the extra "local" is necessary within the if block;
you have already declared it to be local when you initialized it
to the empty string.

-- 
Shawn.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] bash: Add completion for gitk --merge
  2008-04-27  4:18 ` Shawn O. Pearce
@ 2008-04-27 15:35   ` Richard Quirk
  2008-04-27 17:19     ` Shawn O. Pearce
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Quirk @ 2008-04-27 15:35 UTC (permalink / raw)
  To: gitster; +Cc: git, spearce, Richard Quirk

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..23db664 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
+		merge="--merge"
+	fi
 	case "$cur" in
 	--*)
-		__gitcomp "--not --all"
+		__gitcomp "--not --all $merge"
 		return
 		;;
 	esac
-- 
1.5.5.1.79.g57cf

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] bash: Add completion for gitk --merge
  2008-04-27 15:35   ` Richard Quirk
@ 2008-04-27 17:19     ` Shawn O. Pearce
  0 siblings, 0 replies; 4+ messages in thread
From: Shawn O. Pearce @ 2008-04-27 17:19 UTC (permalink / raw)
  To: Richard Quirk; +Cc: gitster, git

Richard Quirk <richard.quirk@gmail.com> wrote:
> Option is only completed when .git/MERGE_HEAD is present.
> 
> Signed-off-by: Richard Quirk <richard.quirk@gmail.com>

Thanks for fixing the unnecessary local and resubmitting.

Acked-by: Shawn O. Pearce <spearce@spearce.org>

> ---
>  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..23db664 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
> +		merge="--merge"
> +	fi
>  	case "$cur" in
>  	--*)
> -		__gitcomp "--not --all"
> +		__gitcomp "--not --all $merge"
>  		return
>  		;;
>  	esac
> -- 
> 1.5.5.1.79.g57cf
> 

-- 
Shawn.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-04-27 17:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-26 23:32 [PATCH] bash: Add completion for gitk --merge Richard Quirk
2008-04-27  4:18 ` Shawn O. Pearce
2008-04-27 15:35   ` Richard Quirk
2008-04-27 17:19     ` 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).