threads / patch / 21400

patchbash completion: difftool accepts the same options as diff

Subject: [PATCH] bash completion: difftool accepts the same options as diff

## tl;dr

2 messages between Oct 28, 2009 and Oct 28, 2009. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Markus Heidelberg· Oct 28, 2009, 09:45 UTC · lore

So complete refs, files after the doubledash and some diff options that make sense for difftool.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
---
 contrib/completion/git-completion.bash |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
Show changes to contrib/completion/git-completion.bash +8 −2
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index d3fec32..45369e2 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -958,6 +958,8 @@ __git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff
 
 _git_difftool ()
 {
+	__git_has_doubledash && return
+
 	local cur="${COMP_WORDS[COMP_CWORD]}"
 	case "$cur" in
 	--tool=*)
@@ -965,11 +967,15 @@ _git_difftool ()
 		return
 		;;
 	--*)
-		__gitcomp "--tool="
+		__gitcomp "--cached --staged --pickaxe-all --pickaxe-regex
+			--base --ours --theirs
+			--no-renames --diff-filter= --find-copies-harder
+			--relative --ignore-submodules
+			--tool="
 		return
 		;;
 	esac
-	COMPREPLY=()
+	__git_complete_file
 }
 
 __git_fetch_options="
-- 
1.6.5.2.86.g61663
Shawn O. Pearce· Oct 28, 2009, 14:32 UTC · re: Markus Heidelberg · lore

Re: [PATCH] bash completion: difftool accepts the same options as diff

Markus Heidelberg <markus.heidelberg@web.de> wrote:
> So complete refs, files after the doubledash and some diff options that
> make sense for difftool.
> 
> Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
>  contrib/completion/git-completion.bash |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
-- 
Shawn.

← back to recent threads