[PATCH 0/2] Helpful completions for merging

DORMANTno replies

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

[PATCH 0/2] Helpful completions for merging

From: Lee Marlow <hidden>
Date: 2016-06-15 22:45:09

These patches just add some simple completions for merging.

Lee Marlow (2):
  bash completion: Add completion for 'git mergetool'
  bash completion: Add '--merge' long option for 'git log'

 contrib/completion/git-completion.bash |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

[PATCH 1/2] bash completion: Add completion for 'git mergetool'

From: Lee Marlow <hidden>
Date: 2016-06-15 22:45:09

The --tool= long option can be completed with
	kdiff3 tkdiff meld xxdiff emerge
	vimdiff gvimdiff ecmerge opendiff

Signed-off-by: Lee Marlow <redacted>
---
 contrib/completion/git-completion.bash |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 78189c1..4089670 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1001,6 +1001,25 @@ _git_merge ()
 	__gitcomp "$(__git_refs)"
 }
 
+_git_mergetool ()
+{
+	local cur="${COMP_WORDS[COMP_CWORD]}"
+	case "$cur" in
+	--tool=*)
+		__gitcomp "
+			kdiff3 tkdiff meld xxdiff emerge
+			vimdiff gvimdiff ecmerge opendiff
+			" "" "${cur##--tool=}"
+		return
+		;;
+	--*)
+		__gitcomp "--tool="
+		return
+		;;
+	esac
+	COMPREPLY=()
+}
+
 _git_merge_base ()
 {
 	__gitcomp "$(__git_refs)"
@@ -1650,6 +1669,7 @@ _git ()
 	ls-remote)   _git_ls_remote ;;
 	ls-tree)     _git_ls_tree ;;
 	merge)       _git_merge;;
+	mergetool)   _git_mergetool;;
 	merge-base)  _git_merge_base ;;
 	mv)          _git_mv ;;
 	name-rev)    _git_name_rev ;;
-- 
1.6.0.rc3.6.ga0653

[PATCH 2/2] bash completion: Add '--merge' long option for 'git log'

From: Lee Marlow <hidden>
Date: 2016-06-15 22:45:09

Signed-off-by: Lee Marlow <redacted>
---
 contrib/completion/git-completion.bash |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 4089670..bdf4f4a 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -972,6 +972,7 @@ _git_log ()
 			--decorate --diff-filter=
 			--color-words --walk-reflogs
 			--parents --children --full-history
+			--merge
 			"
 		return
 		;;
-- 
1.6.0.rc3.6.ga0653

Re: [PATCH 1/2] bash completion: Add completion for 'git mergetool'

From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:45:09

Lee Marlow [off-list ref] wrote:
The --tool= long option can be completed with
	kdiff3 tkdiff meld xxdiff emerge
	vimdiff gvimdiff ecmerge opendiff

Signed-off-by: Lee Marlow <redacted>
Acked-by: Shawn O. Pearce <redacted>

... for both patches in this series.  But this is new functionality
so it probably won't be in 1.6.0; its too late in that release cycle.
quoted hunk
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 78189c1..4089670 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1001,6 +1001,25 @@ _git_merge ()
 	__gitcomp "$(__git_refs)"
 }
 
+_git_mergetool ()
+{
+	local cur="${COMP_WORDS[COMP_CWORD]}"
+	case "$cur" in
+	--tool=*)
+		__gitcomp "
+			kdiff3 tkdiff meld xxdiff emerge
+			vimdiff gvimdiff ecmerge opendiff
+			" "" "${cur##--tool=}"
+		return
+		;;
+	--*)
+		__gitcomp "--tool="
+		return
+		;;
+	esac
+	COMPREPLY=()
+}
+
 _git_merge_base ()
 {
 	__gitcomp "$(__git_refs)"
@@ -1650,6 +1669,7 @@ _git ()
 	ls-remote)   _git_ls_remote ;;
 	ls-tree)     _git_ls_tree ;;
 	merge)       _git_merge;;
+	mergetool)   _git_mergetool;;
 	merge-base)  _git_merge_base ;;
 	mv)          _git_mv ;;
 	name-rev)    _git_name_rev ;;
-- 
Shawn.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help