completion: add completion for --submodule=* diff option

Teach git-completion.bash to complete --submodule= for git commands which take diff options. Also teach completion for git-log to support --diff-algorithms as well. Signed-off-by: Jacob Keller <jacob.keller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jacob Keller committed Aug 9, 2016 at 11:34 UTC ac76fd54a81de658c0e0a14d0fe5826284efdf4a
1 file changed +19
contrib/completion/git-completion.bash
+19
@@ -1158,6 +1158,8 @@ _git_describe ()
1158
1159 __git_diff_algorithms="myers minimal patience histogram"
1160
1161 +__git_diff_submodule_formats="log short"
1162 +
1163 __git_diff_common_options="--stat --numstat --shortstat --summary
1164 --patch-with-stat --name-only --name-status --color
1165 --no-color --color-words --no-renames --check
@@ -1173,6 +1175,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
1175 --dirstat --dirstat= --dirstat-by-file
1176 --dirstat-by-file= --cumulative
1177 --diff-algorithm=
1178 + --submodule --submodule=
1179 "
1180
1181 _git_diff ()
@@ -1184,6 +1187,10 @@ _git_diff ()
1187 __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
1188 return
1189 ;;
1190 + --submodule=*)
1191 + __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
1192 + return
1193 + ;;
1194 --*)
1195 __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex
1196 --base --ours --theirs --no-index
@@ -1447,6 +1454,14 @@ _git_log ()
1454 __gitcomp "full short no" "" "${cur##--decorate=}"
1455 return
1456 ;;
1457 + --diff-algorithm=*)
1458 + __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
1459 + return
1460 + ;;
1461 + --submodule=*)
1462 + __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
1463 + return
1464 + ;;
1465 --*)
1466 __gitcomp "
1467 $__git_log_common_options
@@ -2359,6 +2374,10 @@ _git_show ()
2374 __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
2375 return
2376 ;;
2377 + --submodule=*)
2378 + __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
2379 + return
2380 + ;;
2381 --*)
2382 __gitcomp "--pretty= --format= --abbrev-commit --oneline
2383 --show-signature