[PATCH 0/4] Batch completion improvements

DORMANTno replies

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

[PATCH 0/4] Batch completion improvements

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:57:57

Hi,

An older iteration of [2/4] was just reviewed by SZEDER on the list.
[1/4] and [3/4] have been sent out in the past, but haven't been
picked up.  [4/4] is new.

Thanks.

Ramkumar Ramachandra (4):
  completion: complete rebase --edit-todo
  completion: add completer for status
  completion: add completer for rev-parse
  completion: prefer to use local git-completion.bash

 contrib/completion/git-completion.bash | 45 ++++++++++++++++++++++++++++++++++
 contrib/completion/git-completion.zsh  |  2 +-
 2 files changed, 46 insertions(+), 1 deletion(-)

-- 
1.8.3.1.585.g9832cb9

[PATCH 1/4] completion: complete rebase --edit-todo

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:57:57

Signed-off-by: Ramkumar Ramachandra <redacted>
---
 contrib/completion/git-completion.bash | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 6c3bafe..b51c9e3 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1609,6 +1609,10 @@ _git_rebase ()
 {
 	local dir="$(__gitdir)"
 	if [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then
+		if [ -e "$dir"/rebase-merge/interactive ]; then
+			__gitcomp "--continue --skip --abort --edit-todo"
+			return
+		fi
 		__gitcomp "--continue --skip --abort"
 		return
 	fi
-- 
1.8.3.1.585.g9832cb9

[PATCH 2/4] completion: add completer for status

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:57:57

Helped-by: SZEDER Gábor [off-list ref]
Signed-off-by: Ramkumar Ramachandra <redacted>
---
 contrib/completion/git-completion.bash | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index b51c9e3..278018f 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1699,6 +1699,33 @@ _git_stage ()
 	_git_add
 }
 
+_git_status ()
+{
+	case "$cur" in
+	--untracked-files=*)
+		__gitcomp "no normal all" "" "${cur##--untracked-files=}"
+		return
+		;;
+	--ignore-submodules=*)
+		__gitcomp "none untracked dirty all" "" "${cur##--ignore-submodules=}"
+		return
+		;;
+	--column=*)
+		__gitcomp "always never auto column row plain dense nodense" "" "${cur##--column=}"
+		return
+		;;
+	--*)
+		__gitcomp "
+			--short --branch --long --porcelain --ignored
+			--untracked-files --ignore-submodules --column
+			--untracked-files= --ignore-submodules= --column=
+			"
+		return
+		;;
+	esac
+	__git_complete_index_file "--with-tree=HEAD --cached --others"
+}
+
 __git_config_get_set_variables ()
 {
 	local prevword word config_file= c=$cword
-- 
1.8.3.1.585.g9832cb9

[PATCH 4/4] completion: prefer to use local git-completion.bash

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:57:57

git-completion.zsh looks in various "default" locations for
git-completion.bash.  During development, the location

  $(dirname ${funcsourcetrace[1]%:*})/git-completion.bash

is the most obvious and up-to-date version.  Push it up on the list of
locations.

Signed-off-by: Ramkumar Ramachandra <redacted>
---
 contrib/completion/git-completion.zsh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index fac5e71..6fca145 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -30,10 +30,10 @@ if [ -z "$script" ]; then
 	local -a locations
 	local e
 	locations=(
+		$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash
 		'/etc/bash_completion.d/git' # fedora, old debian
 		'/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian
 		'/usr/share/bash-completion/git' # gentoo
-		$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash
 		)
 	for e in $locations; do
 		test -f $e && script="$e" && break
-- 
1.8.3.1.585.g9832cb9

[PATCH 3/4] completion: add completer for rev-parse

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:57:57

Signed-off-by: Ramkumar Ramachandra <redacted>
---
 contrib/completion/git-completion.bash | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 278018f..f2959a7 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2247,6 +2247,20 @@ _git_reset ()
 	__gitcomp_nl "$(__git_refs)"
 }
 
+_git_rev_parse ()
+{
+	case "$cur" in
+	--*)
+		__gitcomp "
+			--short --show-toplevel --is-inside-work-tree
+			--symbolic-full-name --verify
+			"
+               return
+               ;;
+	esac
+	__gitcomp_nl "$(__git_refs)"
+}
+
 _git_revert ()
 {
 	case "$cur" in
-- 
1.8.3.1.585.g9832cb9

Re: [PATCH 3/4] completion: add completer for rev-parse

From: SZEDER Gábor <hidden>
Date: 2016-06-15 22:57:57

On Fri, Jun 28, 2013 at 07:48:07PM +0530, Ramkumar Ramachandra wrote:
quoted hunk
Signed-off-by: Ramkumar Ramachandra <redacted>
---
 contrib/completion/git-completion.bash | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 278018f..f2959a7 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2247,6 +2247,20 @@ _git_reset ()
 	__gitcomp_nl "$(__git_refs)"
 }
 
+_git_rev_parse ()
+{
+	case "$cur" in
+	--*)
+		__gitcomp "
+			--short --show-toplevel --is-inside-work-tree
+			--symbolic-full-name --verify
+			"
In the completion script we support porcelain commands.  I'm not sure
about 'git rev-parse', but I think it's more plumbing than porcelain.
However, I think the same about 'git ls-tree' and 'git reflog', too,
yet we have support for them in the completion script.

Either way, why these five options?  'git rev-parse' has a lot more
options than that.

+               return
+               ;;
+	esac
+	__gitcomp_nl "$(__git_refs)"
+}
+
 _git_revert ()
 {
 	case "$cur" in
-- 
1.8.3.1.585.g9832cb9

Re: [PATCH 3/4] completion: add completer for rev-parse

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:57:57

SZEDER Gábor wrote:
Either way, why these five options?  'git rev-parse' has a lot more
options than that.
We have to start somewhere, so I put in the options that I personally use.

Re: [PATCH 2/4] completion: add completer for status

From: SZEDER Gábor <hidden>
Date: 2016-06-15 22:57:57

On Fri, Jun 28, 2013 at 07:48:06PM +0530, Ramkumar Ramachandra wrote:
+	__git_complete_index_file "--with-tree=HEAD --cached --others"
The code is OK, the rest of the function is pretty straightforward,
but I think this line would warrant a sentence in the log message,
considering that at first you also wondered what '--with-tree=HEAD' is
about.

Re: [PATCH 2/4] completion: add completer for status

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:57:57

SZEDER Gábor wrote:
The code is OK, the rest of the function is pretty straightforward,
but I think this line would warrant a sentence in the log message,
Okay.

  Complete untracked pathspecs (--others), and overlay HEAD tree on
index (--with-tree=HEAD) to complete pathspecs that have been removed
from the filesystem + staged in the index.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help