completion: recognize more long-options

Command completion only recognizes a subset of the available options for the various git commands. The set of recognized options needs to balance between having all useful options and to not clutter the terminal. This commit adds all long-options that are mentioned in the man-page synopsis of the respective git command. Possibly dangerous options are not included in this set, to avoid accidental data loss. The added options are: - apply: --recount --directory= - archive: --output - branch: --column --no-column --sort= --points-at - clone: --no-single-branch --shallow-submodules - commit: --patch --short --date --allow-empty - describe: --first-parent - fetch, pull: --unshallow --update-shallow - fsck: --name-objects - grep: --break --heading --show-function --function-context --untracked --no-index - mergetool: --prompt --no-prompt - reset: --keep - revert: --strategy= --strategy-option= - shortlog: --email - tag: --merged --no-merged --create-reflog Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com> Helped-by: Johannes Sixt <j6t@kdbg.org> Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Cornelius Weig committed Feb 3, 2017 at 12:01 UTC f483a0aa2a4ca30f4fa76ea4aff621e59cdb882c
1 file changed +20 -9
contrib/completion/git-completion.bash
+20 -9
@@ -936,6 +936,7 @@ _git_apply ()
936 --apply --no-add --exclude=
937 --ignore-whitespace --ignore-space-change
938 --whitespace= --inaccurate-eof --verbose
939 + --recount --directory=
940 "
941 return
942 esac
@@ -974,7 +975,7 @@ _git_archive ()
975 --*)
976 __gitcomp "
977 --format= --list --verbose
977 - --prefix= --remote= --exec=
978 + --prefix= --remote= --exec= --output
979 "
980 return
981 ;;
@@ -1029,6 +1030,7 @@ _git_branch ()
1030 --track --no-track --contains --merged --no-merged
1031 --set-upstream-to= --edit-description --list
1032 --unset-upstream --delete --move --remotes
1033 + --column --no-column --sort= --points-at
1034 "
1035 ;;
1036 *)
@@ -1142,6 +1144,8 @@ _git_clone ()
1144 --single-branch
1145 --branch
1146 --recurse-submodules
1147 + --no-single-branch
1148 + --shallow-submodules
1149 "
1150 return
1151 ;;
@@ -1183,6 +1187,7 @@ _git_commit ()
1187 --reset-author --file= --message= --template=
1188 --cleanup= --untracked-files --untracked-files=
1189 --verbose --quiet --fixup= --squash=
1190 + --patch --short --date --allow-empty
1191 "
1192 return
1193 esac
@@ -1201,7 +1206,7 @@ _git_describe ()
1206 --*)
1207 __gitcomp "
1208 --all --tags --contains --abbrev= --candidates=
1204 - --exact-match --debug --long --match --always
1209 + --exact-match --debug --long --match --always --first-parent
1210 "
1211 return
1212 esac
@@ -1284,6 +1289,7 @@ __git_fetch_recurse_submodules="yes on-demand no"
1289 __git_fetch_options="
1290 --quiet --verbose --append --upload-pack --force --keep --depth=
1291 --tags --no-tags --all --prune --dry-run --recurse-submodules=
1292 + --unshallow --update-shallow
1293 "
1294
1295 _git_fetch ()
@@ -1333,7 +1339,7 @@ _git_fsck ()
1339 --*)
1340 __gitcomp "
1341 --tags --root --unreachable --cache --no-reflogs --full
1336 - --strict --verbose --lost-found
1342 + --strict --verbose --lost-found --name-objects
1343 "
1344 return
1345 ;;
@@ -1377,6 +1383,8 @@ _git_grep ()
1383 --max-depth
1384 --count
1385 --and --or --not --all-match
1386 + --break --heading --show-function --function-context
1387 + --untracked --no-index
1388 "
1389 return
1390 ;;
@@ -1576,7 +1584,7 @@ _git_mergetool ()
1584 return
1585 ;;
1586 --*)
1579 - __gitcomp "--tool="
1587 + __gitcomp "--tool= --prompt --no-prompt"
1588 return
1589 ;;
1590 esac
@@ -2465,7 +2473,7 @@ _git_reset ()
2473
2474 case "$cur" in
2475 --*)
2468 - __gitcomp "--merge --mixed --hard --soft --patch"
2476 + __gitcomp "--merge --mixed --hard --soft --patch --keep"
2477 return
2478 ;;
2479 esac
@@ -2481,7 +2489,10 @@ _git_revert ()
2489 fi
2490 case "$cur" in
2491 --*)
2484 - __gitcomp "--edit --mainline --no-edit --no-commit --signoff"
2492 + __gitcomp "
2493 + --edit --mainline --no-edit --no-commit --signoff
2494 + --strategy= --strategy-option=
2495 + "
2496 return
2497 ;;
2498 esac
@@ -2509,7 +2520,7 @@ _git_shortlog ()
2520 __gitcomp "
2521 $__git_log_common_options
2522 $__git_log_shortlog_options
2512 - --numbered --summary
2523 + --numbered --summary --email
2524 "
2525 return
2526 ;;
@@ -2787,8 +2798,8 @@ _git_tag ()
2798 --*)
2799 __gitcomp "
2800 --list --delete --verify --annotate --message --file
2790 - --sign --cleanup --local-user --force --column --sort
2791 - --contains --points-at
2801 + --sign --cleanup --local-user --force --column --sort=
2802 + --contains --points-at --merged --no-merged --create-reflog
2803 "
2804 ;;
2805 esac