Skip to content

Commit 308d7a7

Browse files
Denton-Lgitster
authored andcommitted
contrib/completion: extract common diff/difftool options
difftool parses its own options and then passes the remaining options onto diff. As a result, they share common command-line options. Instead of duplicating the list, use a shared $__git_diff_difftool_options list. The completion for diff is missing --relative and the completion for difftool is missing --no-index. Add both of these to the common list. Signed-off-by: Denton Liu <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a8fa6a0 commit 308d7a7

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

contrib/completion/git-completion.bash

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,6 +1691,10 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
16911691
--textconv --no-textconv
16921692
"
16931693

1694+
__git_diff_difftool_options="--cached --staged --pickaxe-all --pickaxe-regex
1695+
--base --ours --theirs --no-index --relative
1696+
$__git_diff_common_options"
1697+
16941698
_git_diff ()
16951699
{
16961700
__git_has_doubledash && return
@@ -1713,10 +1717,7 @@ _git_diff ()
17131717
return
17141718
;;
17151719
--*)
1716-
__gitcomp "--cached --staged --pickaxe-all --pickaxe-regex
1717-
--base --ours --theirs --no-index
1718-
$__git_diff_common_options
1719-
"
1720+
__gitcomp "$__git_diff_difftool_options"
17201721
return
17211722
;;
17221723
esac
@@ -1738,11 +1739,7 @@ _git_difftool ()
17381739
return
17391740
;;
17401741
--*)
1741-
__gitcomp_builtin difftool "$__git_diff_common_options
1742-
--base --cached --ours --theirs
1743-
--pickaxe-all --pickaxe-regex
1744-
--relative --staged
1745-
"
1742+
__gitcomp_builtin difftool "$__git_diff_difftool_options"
17461743
return
17471744
;;
17481745
esac

0 commit comments

Comments
 (0)