1
1
#
2
2
# bash completion support for core Git.
3
3
#
4
- # Copyright (C) 2006,2007 Shawn Pearce
4
+ # Copyright (C) 2006,2007 Shawn O. Pearce <[email protected] >
5
5
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
6
+ # Distributed under the GNU General Public License, version 2.0.
6
7
#
7
8
# The contained completion routines provide support for completing:
8
9
#
11
12
# *) .git/remotes file names
12
13
# *) git 'subcommands'
13
14
# *) tree paths within 'ref:path/to/file' expressions
15
+ # *) common --long-options
14
16
#
15
17
# To use these routines:
16
18
#
31
33
# are currently in a git repository. The %s token will be
32
34
# the name of the current branch.
33
35
#
36
+ # To submit patches:
37
+ #
38
+ # *) Read Documentation/SubmittingPatches
39
+ # *) Send all patches to the current maintainer:
40
+ #
41
+ # "Shawn O. Pearce" <[email protected] >
42
+ #
43
+ # *) Always CC the Git mailing list:
44
+ #
45
+
46
+ #
34
47
35
48
__gitdir ()
36
49
{
@@ -262,17 +275,23 @@ __git_commands ()
262
275
applypatch) : ask gittus;;
263
276
archimport) : import;;
264
277
cat-file) : plumbing;;
278
+ check-attr) : plumbing;;
265
279
check-ref-format) : plumbing;;
266
280
commit-tree) : plumbing;;
267
281
convert-objects) : plumbing;;
268
282
cvsexportcommit) : export ;;
269
283
cvsimport) : import;;
270
284
cvsserver) : daemon;;
271
285
daemon) : daemon;;
286
+ diff-files) : plumbing;;
287
+ diff-index) : plumbing;;
288
+ diff-tree) : plumbing;;
272
289
fast-import) : import;;
273
290
fsck-objects) : plumbing;;
291
+ fetch--tool) : plumbing;;
274
292
fetch-pack) : plumbing;;
275
293
fmt-merge-msg) : plumbing;;
294
+ for-each-ref) : plumbing;;
276
295
hash-object) : plumbing;;
277
296
http-* ) : transport;;
278
297
index-pack) : plumbing;;
@@ -573,13 +592,13 @@ _git_log ()
573
592
__gitcomp "
574
593
--max-count= --max-age= --since= --after=
575
594
--min-age= --before= --until=
576
- --root --not -- topo-order --date-order
595
+ --root --topo-order --date-order --reverse
577
596
--no-merges
578
597
--abbrev-commit --abbrev=
579
598
--relative-date
580
599
--author= --committer= --grep=
581
600
--all-match
582
- --pretty= --name-status --name-only
601
+ --pretty= --name-status --name-only --raw
583
602
--not --all
584
603
"
585
604
return
@@ -745,9 +764,11 @@ _git_config ()
745
764
case " $cur " in
746
765
--* )
747
766
__gitcomp "
748
- --global --list --replace-all
767
+ --global --system
768
+ --list --replace-all
749
769
--get --get-all --get-regexp
750
770
--add --unset --unset-all
771
+ --remove-section --rename-section
751
772
"
752
773
return
753
774
;;
@@ -766,7 +787,10 @@ _git_config ()
766
787
remote.* .* )
767
788
local pfx=" ${cur% .* } ."
768
789
cur=" ${cur##* .} "
769
- __gitcomp " url fetch push" " $pfx " " $cur "
790
+ __gitcomp "
791
+ url fetch push skipDefaultUpdate
792
+ receivepack uploadpack tagopt
793
+ " " $pfx " " $cur "
770
794
return
771
795
;;
772
796
remote.* )
@@ -816,6 +840,9 @@ _git_config ()
816
840
format.headers
817
841
gitcvs.enabled
818
842
gitcvs.logfile
843
+ gitcvs.allbinary
844
+ gitcvs.dbname gitcvs.dbdriver gitcvs.dbuser gitcvs.dvpass
845
+ gc.packrefs
819
846
gc.reflogexpire
820
847
gc.reflogexpireunreachable
821
848
gc.rerereresolved
@@ -832,9 +859,11 @@ _git_config ()
832
859
i18n.commitEncoding
833
860
i18n.logOutputEncoding
834
861
log.showroot
862
+ merge.tool
835
863
merge.summary
836
864
merge.verbosity
837
865
pack.window
866
+ pack.depth
838
867
pull.octopus
839
868
pull.twohead
840
869
repack.useDeltaBaseOffset
@@ -858,20 +887,32 @@ _git_remote ()
858
887
while [ $c -lt $COMP_CWORD ]; do
859
888
i=" ${COMP_WORDS[c]} "
860
889
case " $i " in
861
- add|show|prune) command=" $i " ; break ;;
890
+ add|show|prune|update ) command=" $i " ; break ;;
862
891
esac
863
892
c=$(( ++ c))
864
893
done
865
894
866
895
if [ $c -eq $COMP_CWORD -a -z " $command " ]; then
867
- __gitcomp " add show prune"
896
+ __gitcomp " add show prune update "
868
897
return
869
898
fi
870
899
871
900
case " $command " in
872
901
show|prune)
873
902
__gitcomp " $( __git_remotes) "
874
903
;;
904
+ update)
905
+ local i c=' ' IFS=$' \n '
906
+ for i in $( git --git-dir=" $( __gitdir) " config --list) ; do
907
+ case " $i " in
908
+ remotes.* )
909
+ i=" ${i# remotes.} "
910
+ c=" $c ${i/ =*/ } "
911
+ ;;
912
+ esac
913
+ done
914
+ __gitcomp " $c "
915
+ ;;
875
916
* )
876
917
COMPREPLY=()
877
918
;;
@@ -890,6 +931,26 @@ _git_reset ()
890
931
__gitcomp " $( __git_refs) "
891
932
}
892
933
934
+ _git_shortlog ()
935
+ {
936
+ local cur=" ${COMP_WORDS[COMP_CWORD]} "
937
+ case " $cur " in
938
+ --* )
939
+ __gitcomp "
940
+ --max-count= --max-age= --since= --after=
941
+ --min-age= --before= --until=
942
+ --no-merges
943
+ --author= --committer= --grep=
944
+ --all-match
945
+ --not --all
946
+ --numbered --summary
947
+ "
948
+ return
949
+ ;;
950
+ esac
951
+ __git_complete_revlist
952
+ }
953
+
893
954
_git_show ()
894
955
{
895
956
local cur=" ${COMP_WORDS[COMP_CWORD]} "
@@ -947,7 +1008,6 @@ _git ()
947
1008
commit) _git_commit ;;
948
1009
config) _git_config ;;
949
1010
diff) _git_diff ;;
950
- diff-tree) _git_diff_tree ;;
951
1011
fetch) _git_fetch ;;
952
1012
format-patch) _git_format_patch ;;
953
1013
gc) _git_gc ;;
@@ -962,6 +1022,7 @@ _git ()
962
1022
rebase) _git_rebase ;;
963
1023
remote) _git_remote ;;
964
1024
reset) _git_reset ;;
1025
+ shortlog) _git_shortlog ;;
965
1026
show) _git_show ;;
966
1027
show-branch) _git_log ;;
967
1028
whatchanged) _git_log ;;
@@ -992,7 +1053,6 @@ complete -o default -o nospace -F _git_cherry git-cherry
992
1053
complete -o default -o nospace -F _git_cherry_pick git-cherry-pick
993
1054
complete -o default -o nospace -F _git_commit git-commit
994
1055
complete -o default -o nospace -F _git_diff git-diff
995
- complete -o default -o nospace -F _git_diff_tree git-diff-tree
996
1056
complete -o default -o nospace -F _git_fetch git-fetch
997
1057
complete -o default -o nospace -F _git_format_patch git-format-patch
998
1058
complete -o default -o nospace -F _git_gc git-gc
@@ -1008,6 +1068,7 @@ complete -o default -o nospace -F _git_rebase git-rebase
1008
1068
complete -o default -o nospace -F _git_config git-config
1009
1069
complete -o default -o nospace -F _git_remote git-remote
1010
1070
complete -o default -o nospace -F _git_reset git-reset
1071
+ complete -o default -o nospace -F _git_shortlog git-shortlog
1011
1072
complete -o default -o nospace -F _git_show git-show
1012
1073
complete -o default -o nospace -F _git_log git-show-branch
1013
1074
complete -o default -o nospace -F _git_log git-whatchanged
@@ -1023,14 +1084,14 @@ complete -o default -o nospace -F _git git.exe
1023
1084
complete -o default -o nospace -F _git_branch git-branch.exe
1024
1085
complete -o default -o nospace -F _git_cherry git-cherry.exe
1025
1086
complete -o default -o nospace -F _git_diff git-diff.exe
1026
- complete -o default -o nospace -F _git_diff_tree git-diff-tree.exe
1027
1087
complete -o default -o nospace -F _git_format_patch git-format-patch.exe
1028
1088
complete -o default -o nospace -F _git_log git-log.exe
1029
1089
complete -o default -o nospace -F _git_ls_tree git-ls-tree.exe
1030
1090
complete -o default -o nospace -F _git_merge_base git-merge-base.exe
1031
1091
complete -o default -o nospace -F _git_name_rev git-name-rev.exe
1032
1092
complete -o default -o nospace -F _git_push git-push.exe
1033
1093
complete -o default -o nospace -F _git_config git-config
1094
+ complete -o default -o nospace -F _git_shortlog git-shortlog.exe
1034
1095
complete -o default -o nospace -F _git_show git-show.exe
1035
1096
complete -o default -o nospace -F _git_log git-show-branch.exe
1036
1097
complete -o default -o nospace -F _git_log git-whatchanged.exe
0 commit comments