[PATCH 0/2] Update BASH completions

STALE3738d

Revision v1 of 2 in this series.

7 messages, 2 authors, 2016-06-15 · open the first message on its own page

[PATCH 0/2] Update BASH completions

From: Paul Wagland <hidden>
Date: 2016-06-15 23:07:51

While playing around git stash I noticed that some options were
missing. I have updated these in the BASH completions file. Note
that this is not a comprehensive review, but adds the options that
I use in git-stash, and a nearby missing option.

Paul Wagland (2):
  Update the flags for git show-branch
  Fix up the arguments for git stash. This adds the branch to the branch
    subcommand, and adds the missing options to save and drop commands

 contrib/completion/git-completion.bash | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

--
2.7.0

PATCH 1/2] Update the flags for git show-branch

From: Paul Wagland <hidden>
Date: 2016-06-15 23:07:51

Signed-off-by: Paul Wagland <redacted>
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index ab4da7f..63754bc 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2369,7 +2369,7 @@ _git_show_branch ()
 	case "$cur" in
 	--*)
 		__gitcomp "
-			--all --remotes --topo-order --current --more=
+			--all --remotes --topo-order --date-order --current --more=
 			--list --independent --merge-base --no-name
 			--color --no-color
 			--sha1-name --sparse --topics --reflog
--
2.7.0

[PATCH 2/2] Fix up the arguments for git stash.

From: Paul Wagland <hidden>
Date: 2016-06-15 23:07:51

Signed-off-by: Paul Wagland <redacted>
---
 contrib/completion/git-completion.bash | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 63754bc..043d5bb 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2382,7 +2382,7 @@ _git_show_branch ()
 
 _git_stash ()
 {
-	local save_opts='--keep-index --no-keep-index --quiet --patch'
+	local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'
 	local subcommands='save list show apply clear drop pop create branch'
 	local subcommand="$(__git_find_on_cmdline "$subcommands")"
 	if [ -z "$subcommand" ]; then
@@ -2404,9 +2404,20 @@ _git_stash ()
 		apply,--*|pop,--*)
 			__gitcomp "--index --quiet"
 			;;
-		show,--*|drop,--*|branch,--*)
+		drop,--*)
+			__gitcomp "--quiet"
 			;;
-		show,*|apply,*|drop,*|pop,*|branch,*)
+		show,--*|branch,--*)
+			;;
+		branch,*)
+			if [ $cword -eq 3 ]; then
+			__gitcomp_nl "$(__git_refs)";
+			else
+				__gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
+						| sed -n -e 's/:.*//p')"
+			fi
+			;;
+		show,*|apply,*|drop,*|pop,*)
 			__gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
 					| sed -n -e 's/:.*//p')"
 			;;
-- 
2.7.0

[PATCH v2 0/2] Update BASH completions

From: Paul Wagland <hidden>
Date: 2016-06-15 23:07:53

While playing around git stash I noticed that some options were
missing. I have updated these in the BASH completions file. Note
that this is not a comprehensive review, but adds the options that
I use in git-stash, and a nearby missing option.

This re-roll doesn't change the code, but updates the commit comments
to make it clearer what each change is doing.

Paul Wagland (2):
  Update the flags for git show-branch
  Fix up the arguments for git stash. This adds the branch to the branch
    subcommand, and adds the missing options to save and drop commands

 contrib/completion/git-completion.bash | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

--
2.7.0

[PATCH v2 1/2] completion: complete show-branch "--date-order"

From: Paul Wagland <hidden>
Date: 2016-06-15 23:07:53

Signed-off-by: Paul Wagland <redacted>
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index ab4da7f..63754bc 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2369,7 +2369,7 @@ _git_show_branch ()
 	case "$cur" in
 	--*)
 		__gitcomp "
-			--all --remotes --topo-order --current --more=
+			--all --remotes --topo-order --date-order --current --more=
 			--list --independent --merge-base --no-name
 			--color --no-color
 			--sha1-name --sparse --topics --reflog
-- 
2.7.0

[PATCH v2 2/4] completion: update completion arguments for stash

From: Paul Wagland <hidden>
Date: 2016-06-15 23:07:53

Add --all and --include-untracked to the git stash save completions.
Add --quiet to the git stash drop completions.
Update git stash branch so that the first argument expands out to the
possible branch names, and the other arguments expand to the stash
names.

Signed-off-by: Paul Wagland <redacted>
---
 contrib/completion/git-completion.bash | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 63754bc..043d5bb 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2382,7 +2382,7 @@ _git_show_branch ()
 
 _git_stash ()
 {
-	local save_opts='--keep-index --no-keep-index --quiet --patch'
+	local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'
 	local subcommands='save list show apply clear drop pop create branch'
 	local subcommand="$(__git_find_on_cmdline "$subcommands")"
 	if [ -z "$subcommand" ]; then
@@ -2404,9 +2404,20 @@ _git_stash ()
 		apply,--*|pop,--*)
 			__gitcomp "--index --quiet"
 			;;
-		show,--*|drop,--*|branch,--*)
+		drop,--*)
+			__gitcomp "--quiet"
 			;;
-		show,*|apply,*|drop,*|pop,*|branch,*)
+		show,--*|branch,--*)
+			;;
+		branch,*)
+		  if [ $cword -eq 3 ]; then
+  			__gitcomp_nl "$(__git_refs)";
+			else
+				__gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
+						| sed -n -e 's/:.*//p')"
+			fi
+			;;
+		show,*|apply,*|drop,*|pop,*)
 			__gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
 					| sed -n -e 's/:.*//p')"
 			;;
-- 
2.7.0

[PATCH] completion: fix mis-indentation in _git_stash()

From: SZEDER Gábor <hidden>
Date: 2016-06-15 23:08:21

Signed-off-by: SZEDER Gábor <redacted>
---
 contrib/completion/git-completion.bash | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 45ec47f2b1b4..e3918c87e3ad 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2415,8 +2415,8 @@ _git_stash ()
 		show,--*|branch,--*)
 			;;
 		branch,*)
-		  if [ $cword -eq 3 ]; then
-			__gitcomp_nl "$(__git_refs)";
+			if [ $cword -eq 3 ]; then
+				__gitcomp_nl "$(__git_refs)";
 			else
 				__gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
 						| sed -n -e 's/:.*//p')"
-- 
2.7.1.384.g61d9461
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help