From: "Shawn O. Pearce" <spearce@spearce.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: [PATCH 1/4] Support --strategy=x completion in addition to --strategy x.
Date: Mon, 27 Nov 2006 15:10:42 -0500 [thread overview]
Message-ID: <20061127201041.GA7308@spearce.org> (raw)
Because git-merge and git-rebase both accept -s, --strategy or --strategy=
we should recognize all three formats in the bash completion functions and
issue back all merge strategies on demand.
I also moved the prior word testing to be before the current word testing,
as the current word cannot be completed with -- if the prior word was an
option which requires a parameter, such as -s or --strategy.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
contrib/completion/git-completion.bash | 30 ++++++++++++++++++++----------
1 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index a957165..e53f040 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -455,18 +455,23 @@ _git_log ()
_git_merge ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "${COMP_WORDS[COMP_CWORD-1]}" in
+ -s|--strategy)
+ COMPREPLY=($(compgen -W "$(__git_merge_strategies)" -- "$cur"))
+ return
+ esac
case "$cur" in
+ --strategy=*)
+ COMPREPLY=($(compgen -W "$(__git_merge_strategies)" \
+ -- "${cur##--strategy=}"))
+ return
+ ;;
--*)
COMPREPLY=($(compgen -W "
--no-commit --no-summary --squash --strategy
" -- "$cur"))
return
esac
- case "${COMP_WORDS[COMP_CWORD-1]}" in
- -s|--strategy)
- COMPREPLY=($(compgen -W "$(__git_merge_strategies)" -- "$cur"))
- return
- esac
COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
}
@@ -543,18 +548,23 @@ _git_rebase ()
" -- "$cur"))
return
fi
+ case "${COMP_WORDS[COMP_CWORD-1]}" in
+ -s|--strategy)
+ COMPREPLY=($(compgen -W "$(__git_merge_strategies)" -- "$cur"))
+ return
+ esac
case "$cur" in
+ --strategy=*)
+ COMPREPLY=($(compgen -W "$(__git_merge_strategies)" \
+ -- "${cur##--strategy=}"))
+ return
+ ;;
--*)
COMPREPLY=($(compgen -W "
--onto --merge --strategy
" -- "$cur"))
return
esac
- case "${COMP_WORDS[COMP_CWORD-1]}" in
- -s|--strategy)
- COMPREPLY=($(compgen -W "$(__git_merge_strategies)" -- "$cur"))
- return
- esac
COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
}
--
1.4.4.1.ge3fb
reply other threads:[~2006-11-27 20:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061127201041.GA7308@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.