* [PATCH 1/4] bash: rename __git_find_subcommand() to __git_find_on_cmdline()
@ 2009-09-15 10:21 SZEDER Gábor
2009-09-15 10:21 ` [PATCH 2/4] bash: update 'git stash' completion SZEDER Gábor
0 siblings, 1 reply; 7+ messages in thread
From: SZEDER Gábor @ 2009-09-15 10:21 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: git, Junio C Hamano, SZEDER Gábor
__git_find_subcommand() was originally meant to check whether
subcommands are already present on the command line. But the code is
general enough to be used for checking the presence of command line
options as well, and the next commit will use it for that purpose, so
let's give it a more general name.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
contrib/completion/git-completion.bash | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index f47c519..c539385 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -619,8 +619,8 @@ __git_aliased_command ()
done
}
-# __git_find_subcommand requires 1 argument
-__git_find_subcommand ()
+# __git_find_on_cmdline requires 1 argument
+__git_find_on_cmdline ()
{
local word subcommand c=1
@@ -739,7 +739,7 @@ _git_bisect ()
__git_has_doubledash && return
local subcommands="start bad good skip reset visualize replay log run"
- local subcommand="$(__git_find_subcommand "$subcommands")"
+ local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
return
@@ -1751,7 +1751,7 @@ _git_config ()
_git_remote ()
{
local subcommands="add rename rm show prune update set-head"
- local subcommand="$(__git_find_subcommand "$subcommands")"
+ local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
return
@@ -1879,7 +1879,7 @@ _git_show_branch ()
_git_stash ()
{
local subcommands='save list show apply clear drop pop create branch'
- local subcommand="$(__git_find_subcommand "$subcommands")"
+ local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
else
@@ -1910,7 +1910,7 @@ _git_submodule ()
__git_has_doubledash && return
local subcommands="add status init update summary foreach sync"
- if [ -z "$(__git_find_subcommand "$subcommands")" ]; then
+ if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
@@ -1932,7 +1932,7 @@ _git_svn ()
proplist show-ignore show-externals branch tag blame
migrate
"
- local subcommand="$(__git_find_subcommand "$subcommands")"
+ local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
else
--
1.6.5.rc1.92.gee3c1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] bash: update 'git stash' completion
2009-09-15 10:21 [PATCH 1/4] bash: rename __git_find_subcommand() to __git_find_on_cmdline() SZEDER Gábor
@ 2009-09-15 10:21 ` SZEDER Gábor
2009-09-15 10:21 ` [PATCH 3/4] bash: teach 'git reset --patch' SZEDER Gábor
0 siblings, 1 reply; 7+ messages in thread
From: SZEDER Gábor @ 2009-09-15 10:21 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: git, Junio C Hamano, SZEDER Gábor
This update adds 'git stash (apply|pop) --quiet' and all options known
to 'git stash save', and handles the DWIMery from 3c2eb80f (stash:
simplify defaulting to "save" and reject unknown options, 2009-08-18).
Care is taken to avoid offering subcommands in the DWIM case.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
contrib/completion/git-completion.bash | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index c539385..2529cec 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1878,18 +1878,30 @@ _git_show_branch ()
_git_stash ()
{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ local save_opts='--keep-index --no-keep-index --quiet --patch'
local subcommands='save list show apply clear drop pop create branch'
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
- __gitcomp "$subcommands"
+ case "$cur" in
+ --*)
+ __gitcomp "$save_opts"
+ ;;
+ *)
+ if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then
+ __gitcomp "$subcommands"
+ else
+ COMPREPLY=()
+ fi
+ ;;
+ esac
else
- local cur="${COMP_WORDS[COMP_CWORD]}"
case "$subcommand,$cur" in
save,--*)
- __gitcomp "--keep-index"
+ __gitcomp "$save_opts"
;;
apply,--*|pop,--*)
- __gitcomp "--index"
+ __gitcomp "--index --quiet"
;;
show,--*|drop,--*|branch,--*)
COMPREPLY=()
--
1.6.5.rc1.92.gee3c1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] bash: teach 'git reset --patch'
2009-09-15 10:21 ` [PATCH 2/4] bash: update 'git stash' completion SZEDER Gábor
@ 2009-09-15 10:21 ` SZEDER Gábor
2009-09-15 10:21 ` [PATCH 4/4] bash: teach 'git checkout' options SZEDER Gábor
2009-09-22 15:29 ` [PATCH 3/4] bash: teach 'git reset --patch' Shawn O. Pearce
0 siblings, 2 replies; 7+ messages in thread
From: SZEDER Gábor @ 2009-09-15 10:21 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: git, Junio C Hamano, SZEDER Gábor
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
contrib/completion/git-completion.bash | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 2529cec..8c268a1 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1782,7 +1782,7 @@ _git_reset ()
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--*)
- __gitcomp "--merge --mixed --hard --soft"
+ __gitcomp "--merge --mixed --hard --soft --patch"
return
;;
esac
--
1.6.5.rc1.92.gee3c1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] bash: teach 'git checkout' options
2009-09-15 10:21 ` [PATCH 3/4] bash: teach 'git reset --patch' SZEDER Gábor
@ 2009-09-15 10:21 ` SZEDER Gábor
2009-09-22 15:28 ` Shawn O. Pearce
2009-09-22 15:29 ` [PATCH 3/4] bash: teach 'git reset --patch' Shawn O. Pearce
1 sibling, 1 reply; 7+ messages in thread
From: SZEDER Gábor @ 2009-09-15 10:21 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: git, Junio C Hamano, SZEDER Gábor
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
contrib/completion/git-completion.bash | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 8c268a1..8e3cdbd 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -809,7 +809,18 @@ _git_checkout ()
{
__git_has_doubledash && return
- __gitcomp "$(__git_refs)"
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ --*)
+ __gitcomp "
+ --quiet --ours --theirs --track --no-track --merge
+ --conflict= --patch
+ "
+ ;;
+ *)
+ __gitcomp "$(__git_refs)"
+ ;;
+ esac
}
_git_cherry ()
--
1.6.5.rc1.92.gee3c1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 4/4] bash: teach 'git checkout' options
2009-09-15 10:21 ` [PATCH 4/4] bash: teach 'git checkout' options SZEDER Gábor
@ 2009-09-22 15:28 ` Shawn O. Pearce
2009-09-24 12:23 ` [PATCHv2] " SZEDER Gábor
0 siblings, 1 reply; 7+ messages in thread
From: Shawn O. Pearce @ 2009-09-22 15:28 UTC (permalink / raw)
To: SZEDER G??bor; +Cc: git, Junio C Hamano
SZEDER G??bor <szeder@ira.uka.de> wrote:
> @@ -809,7 +809,18 @@ _git_checkout ()
> {
> __git_has_doubledash && return
>
> - __gitcomp "$(__git_refs)"
> + local cur="${COMP_WORDS[COMP_CWORD]}"
> + case "$cur" in
> + --*)
> + __gitcomp "
> + --quiet --ours --theirs --track --no-track --merge
> + --conflict= --patch
If we are completing long options, shouldn't we also complete the
supported values for --conflict? According to the docs, this is
'merge' and 'diff3'.
--
Shawn.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/4] bash: teach 'git reset --patch'
2009-09-15 10:21 ` [PATCH 3/4] bash: teach 'git reset --patch' SZEDER Gábor
2009-09-15 10:21 ` [PATCH 4/4] bash: teach 'git checkout' options SZEDER Gábor
@ 2009-09-22 15:29 ` Shawn O. Pearce
1 sibling, 0 replies; 7+ messages in thread
From: Shawn O. Pearce @ 2009-09-22 15:29 UTC (permalink / raw)
To: SZEDER G??bor; +Cc: git, Junio C Hamano
SZEDER G??bor <szeder@ira.uka.de> wrote:
> Signed-off-by: SZEDER G??bor <szeder@ira.uka.de>
> ---
> contrib/completion/git-completion.bash | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
1-3 of this series are:
Trivially-acked-by: Shawn O. Pearce <spearce@spearce.org>
--
Shawn.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCHv2] bash: teach 'git checkout' options
2009-09-22 15:28 ` Shawn O. Pearce
@ 2009-09-24 12:23 ` SZEDER Gábor
0 siblings, 0 replies; 7+ messages in thread
From: SZEDER Gábor @ 2009-09-24 12:23 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: git, Junio C Hamano, SZEDER Gábor
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
contrib/completion/git-completion.bash | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 8c268a1..a08e471 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -809,7 +809,21 @@ _git_checkout ()
{
__git_has_doubledash && return
- __gitcomp "$(__git_refs)"
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ --conflict=*)
+ __gitcomp "diff3 merge" "" "${cur##--conflict=}"
+ ;;
+ --*)
+ __gitcomp "
+ --quiet --ours --theirs --track --no-track --merge
+ --conflict= --patch
+ "
+ ;;
+ *)
+ __gitcomp "$(__git_refs)"
+ ;;
+ esac
}
_git_cherry ()
--
1.6.5.rc2.85.gd02ad
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-09-24 12:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-15 10:21 [PATCH 1/4] bash: rename __git_find_subcommand() to __git_find_on_cmdline() SZEDER Gábor
2009-09-15 10:21 ` [PATCH 2/4] bash: update 'git stash' completion SZEDER Gábor
2009-09-15 10:21 ` [PATCH 3/4] bash: teach 'git reset --patch' SZEDER Gábor
2009-09-15 10:21 ` [PATCH 4/4] bash: teach 'git checkout' options SZEDER Gábor
2009-09-22 15:28 ` Shawn O. Pearce
2009-09-24 12:23 ` [PATCHv2] " SZEDER Gábor
2009-09-22 15:29 ` [PATCH 3/4] bash: teach 'git reset --patch' 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).