summaryrefslogtreecommitdiff
path: root/contrib/completion/git-completion.bash
diff options
context:
space:
mode:
authorDenton Liu <liu.denton@gmail.com>2020-09-17 07:44:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-09-17 16:38:47 (GMT)
commit308d7a7dc99043c90a9eff6916cad1abe0d473aa (patch)
tree6c66a73ff523ff2d11d9ba063ab30d3f73b08912 /contrib/completion/git-completion.bash
parenta8fa6a08f4ff3ab99f99dd7ae989bd825071def3 (diff)
downloadgit-308d7a7dc99043c90a9eff6916cad1abe0d473aa.zip
git-308d7a7dc99043c90a9eff6916cad1abe0d473aa.tar.gz
git-308d7a7dc99043c90a9eff6916cad1abe0d473aa.tar.bz2
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 <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/completion/git-completion.bash')
-rw-r--r--contrib/completion/git-completion.bash15
1 files changed, 6 insertions, 9 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 9147fba..f68c8e0 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1691,6 +1691,10 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
--textconv --no-textconv
"
+__git_diff_difftool_options="--cached --staged --pickaxe-all --pickaxe-regex
+ --base --ours --theirs --no-index --relative
+ $__git_diff_common_options"
+
_git_diff ()
{
__git_has_doubledash && return
@@ -1713,10 +1717,7 @@ _git_diff ()
return
;;
--*)
- __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex
- --base --ours --theirs --no-index
- $__git_diff_common_options
- "
+ __gitcomp "$__git_diff_difftool_options"
return
;;
esac
@@ -1738,11 +1739,7 @@ _git_difftool ()
return
;;
--*)
- __gitcomp_builtin difftool "$__git_diff_common_options
- --base --cached --ours --theirs
- --pickaxe-all --pickaxe-regex
- --relative --staged
- "
+ __gitcomp_builtin difftool "$__git_diff_difftool_options"
return
;;
esac