Skip to content

Commit f483a0a

Browse files
Cornelius Weiggitster
authored andcommitted
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>
1 parent cac8496 commit f483a0a

1 file changed

Lines changed: 20 additions & 9 deletions

File tree

contrib/completion/git-completion.bash

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,7 @@ _git_apply ()
936936
--apply --no-add --exclude=
937937
--ignore-whitespace --ignore-space-change
938938
--whitespace= --inaccurate-eof --verbose
939+
--recount --directory=
939940
"
940941
return
941942
esac
@@ -974,7 +975,7 @@ _git_archive ()
974975
--*)
975976
__gitcomp "
976977
--format= --list --verbose
977-
--prefix= --remote= --exec=
978+
--prefix= --remote= --exec= --output
978979
"
979980
return
980981
;;
@@ -1029,6 +1030,7 @@ _git_branch ()
10291030
--track --no-track --contains --merged --no-merged
10301031
--set-upstream-to= --edit-description --list
10311032
--unset-upstream --delete --move --remotes
1033+
--column --no-column --sort= --points-at
10321034
"
10331035
;;
10341036
*)
@@ -1142,6 +1144,8 @@ _git_clone ()
11421144
--single-branch
11431145
--branch
11441146
--recurse-submodules
1147+
--no-single-branch
1148+
--shallow-submodules
11451149
"
11461150
return
11471151
;;
@@ -1183,6 +1187,7 @@ _git_commit ()
11831187
--reset-author --file= --message= --template=
11841188
--cleanup= --untracked-files --untracked-files=
11851189
--verbose --quiet --fixup= --squash=
1190+
--patch --short --date --allow-empty
11861191
"
11871192
return
11881193
esac
@@ -1201,7 +1206,7 @@ _git_describe ()
12011206
--*)
12021207
__gitcomp "
12031208
--all --tags --contains --abbrev= --candidates=
1204-
--exact-match --debug --long --match --always
1209+
--exact-match --debug --long --match --always --first-parent
12051210
"
12061211
return
12071212
esac
@@ -1284,6 +1289,7 @@ __git_fetch_recurse_submodules="yes on-demand no"
12841289
__git_fetch_options="
12851290
--quiet --verbose --append --upload-pack --force --keep --depth=
12861291
--tags --no-tags --all --prune --dry-run --recurse-submodules=
1292+
--unshallow --update-shallow
12871293
"
12881294

12891295
_git_fetch ()
@@ -1333,7 +1339,7 @@ _git_fsck ()
13331339
--*)
13341340
__gitcomp "
13351341
--tags --root --unreachable --cache --no-reflogs --full
1336-
--strict --verbose --lost-found
1342+
--strict --verbose --lost-found --name-objects
13371343
"
13381344
return
13391345
;;
@@ -1377,6 +1383,8 @@ _git_grep ()
13771383
--max-depth
13781384
--count
13791385
--and --or --not --all-match
1386+
--break --heading --show-function --function-context
1387+
--untracked --no-index
13801388
"
13811389
return
13821390
;;
@@ -1576,7 +1584,7 @@ _git_mergetool ()
15761584
return
15771585
;;
15781586
--*)
1579-
__gitcomp "--tool="
1587+
__gitcomp "--tool= --prompt --no-prompt"
15801588
return
15811589
;;
15821590
esac
@@ -2465,7 +2473,7 @@ _git_reset ()
24652473

24662474
case "$cur" in
24672475
--*)
2468-
__gitcomp "--merge --mixed --hard --soft --patch"
2476+
__gitcomp "--merge --mixed --hard --soft --patch --keep"
24692477
return
24702478
;;
24712479
esac
@@ -2481,7 +2489,10 @@ _git_revert ()
24812489
fi
24822490
case "$cur" in
24832491
--*)
2484-
__gitcomp "--edit --mainline --no-edit --no-commit --signoff"
2492+
__gitcomp "
2493+
--edit --mainline --no-edit --no-commit --signoff
2494+
--strategy= --strategy-option=
2495+
"
24852496
return
24862497
;;
24872498
esac
@@ -2509,7 +2520,7 @@ _git_shortlog ()
25092520
__gitcomp "
25102521
$__git_log_common_options
25112522
$__git_log_shortlog_options
2512-
--numbered --summary
2523+
--numbered --summary --email
25132524
"
25142525
return
25152526
;;
@@ -2787,8 +2798,8 @@ _git_tag ()
27872798
--*)
27882799
__gitcomp "
27892800
--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
27922803
"
27932804
;;
27942805
esac

0 commit comments

Comments
 (0)