mirrored from git://git.code.sf.net/p/zsh/code
-
Notifications
You must be signed in to change notification settings - Fork 442
/
_git
8741 lines (7971 loc) · 394 KB
/
_git
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#compdef git git-cvsserver git-receive-pack git-upload-archive git-upload-pack git-shell gitk tig
# Some parts of this completion's behaviour are configurable:
#
# Say you got your own git sub-commands (git will run a program `git-foo'
# when you run "git foo") and you want "git f<tab>" to complete that sub
# commands name for you. You can make that sub-command known to the completion
# via the user-command style:
#
# % zstyle ':completion:*:*:git:*' user-commands foo:'description for foo'
#
# `user-commands' is a list style, so you can add any number of programs there.
# The :description part is optional, so you could add all git-* programs from
# your $path like this:
#
# % zstyle ':completion:*:*:git:*' user-commands ${${(M)${(k)commands}:#git-*}/git-/}
#
# A better solution is to create a function _git-foo() to handle specific
# completion for that command. This also allows you to add command-specific
# completion as well. Place such a function inside an autoloaded #compdef file
# and you should be all set. You can add a description to such a function by
# adding a line matching
#
# #description DESCRIPTION
#
# as the second line in the file. See
# Completion/Debian/Command/_git-buildpackage in the Zsh sources for an
# example.
#
# When _git does not know a given sub-command (say `bar'), it falls back to
# completing file names for all arguments to that sub command. I.e.:
#
# % git bar <tab>
#
# ...will complete file names. If you do *not* want that fallback to be used,
# use the `use-fallback' style like this:
#
# % zstyle ':completion:*:*:git*:*' use-fallback false
# TODO: There is still undocumented configurability in here.
# HIGH-LEVEL COMMANDS (PORCELAIN)
# Main Porcelain Commands
(( $+functions[_git-add] )) ||
_git-add () {
local curcontext=$curcontext state line ret=1
declare -A opt_args
local ignore_missing=
if (( words[(I)-n|--dry-run] )); then
ignore_missing='--ignore-missing[check if files (even missing) are ignored in dry run]'
fi
_arguments -C -S -s $endopt \
'(-n --dry-run)'{-n,--dry-run}'[do not actually add files; only show which ones would be added]' \
'(-v --verbose)'{-v,--verbose}'[show files as they are added]' \
'(-f --force)'{-f,--force}'[allow adding otherwise ignored files]' \
'(-i --interactive : -)'{-i,--interactive}'[add contents interactively to index]' \
'(-p --patch)'{-p,--patch}'[like -i but go directly into patch mode for specified files]' \
'(-e --edit)'{-e,--edit}'[open diff against index in editor]' \
'(-A --all --no-ignore-removal -u --update --no-all --ignore-removal --renormalize)'{-A,--all,--no-ignore-removal}'[add, modify, and remove index entries to match the working tree]' \
'(-A --all --no-ignore-removal -u --update --no-all --ignore-removal --renormalize)'{--no-all,--ignore-removal}'[like "--all" but ignore removals]' \
'(-A --all --no-ignore-removal -u --update --no-all --ignore-removal)'{-u,--update}'[update the index just where it already has an entry matching <pathspec>]' \
'(-A --all --no-ignore-removal -u --update --no-all --ignore-removal)--renormalize[renormalize EOL of tracked files (implies -u)]' \
'(-N --intent-to-add)'{-N,--intent-to-add}'[record only that path will be added later]' \
'--refresh[do not add files, but refresh their stat() info in index]' \
'--ignore-errors[continue adding if an error occurs]' \
$ignore_missing \
'--sparse[allow updating entries outside of sparse-checkout cone]' \
'--chmod=[override the executable bit of the listed files]:override:(-x +x)' \
'(*)--pathspec-from-file=[read pathspec from file]:file:_files' \
'(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \
'*:: :->file' && return
case $state in
(file)
declare -a file_alternatives
if [[ -z ${opt_args[(I)-u|--update]} ]]; then
file_alternatives=(
'other-files::__git_ignore_line_inside_arguments __git_other_files'
)
fi
if [[ -n ${opt_args[(I)-f|--force]} ]]; then
file_alternatives+=(
'ignored-modified-files:ignored modified file:__git_ignore_line_inside_arguments __git_modified_files --ignored'
'ignored-other-files:ignored other file:__git_ignore_line_inside_arguments __git_other_files --ignored')
fi
_alternative \
'modified-files::__git_ignore_line_inside_arguments __git_modified_files' \
$file_alternatives && ret=0
;;
esac
return ret
}
(( $+functions[_git-am] )) ||
_git-am () {
local -a apply_options
__git_setup_apply_options
# NOTE: --rebasing and --resolvemsg are only for internal use between git
# rebase and git am.
_arguments -s -S $endopt \
'(-s --signoff)'{-s,--signoff}'[add Signed-off-by: trailer to the commit message]' \
'(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \
"(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \
'(-k --keep)'{-k,--keep}'[pass -k to git mailinfo]' \
'--keep-non-patch[pass -b to git mailinfo]' \
'(-m --message-id)'{-m,--message-id}'[pass -m flag to git-mailinfo]' \
'( --no-keep-cr)--keep-cr[pass --keep-cr to git mailsplit]' \
'(--keep-cr )--no-keep-cr[do not pass --keep-cr to git mailsplit]' \
'(-c --scissors --no-scissors)'{-c,--scissors}'[strip everything before a scissors line]' \
'(-c --scissors --no-scissors)--no-scissors[ignore scissors lines]' \
'--quoted-cr=[specify action when quoted CR is found]:action [warn]:(nowarn warn strip)' \
'(-q --quiet)'{-q,--quiet}'[only print error messages]' \
'(-u --utf8 --no-utf8)'{-u,--utf8}'[pass -u to git mailinfo]' \
'(-u --utf8 --no-utf8)--no-utf8[pass -n to git mailinfo]' \
'(-3 --3way)'{-3,--3way}'[use 3-way merge if patch does not apply cleanly]' \
$apply_options \
'--quit[abort the patching operation but keep HEAD where it is]' \
'--show-current-patch=-[show the message being applied]::show [raw]:(diff raw)' \
'(--empty)--allow-empty[record the empty patch as an empty commit]' \
'(--allow-empty)--empty=[select hanndling of empty patches]:handling:(stop drop keep)' \
'(-i --interactive)'{-i,--interactive}'[apply patches interactively]' \
'(-n --no-verify)'{-n,--no-verify}'[bypass pre-applypatch and applypatch-msg hooks]' \
'--committer-date-is-author-date[use author date as committer date]' \
'--ignore-date[use committer date as author date]' \
'--skip[skip the current patch]' \
'(--continue -r --resolved)'{--continue,-r,--resolved}'[continue after resolving patch failure by hand]' \
'--abort[restore the original branch and abort the patching operation]' \
'--patch-format=-[specify format patches are in]:patch format:((mbox\:"mbox format"
stgit-series\:"StGit patch series"
stgit\:"stgit format"))' \
'*:mbox file:_files'
}
(( $+functions[_git-archive] )) ||
_git-archive () {
local curcontext=$curcontext state line ret=1
declare -A opt_args
declare -a backend_args
if (( words[(b:CURRENT-1:I)--format=*] )); then
case ${words[$words[(I)--format=*]]#--format=} in
(zip)
backend_args=(
'-0[do not deflate files]'
'-1[minimum compression]'
'-2[a little more compression]'
'-3[slightly more compression]'
'-4[a bit more compression]'
'-5[even more compression]'
'-6[slightly even more compression]'
'-7[getting there]'
'-8[close to maximum compression]'
'-9[maximum compression]')
;;
esac
fi
_arguments -C -S -s $endopt \
'--format=-[format of the resulting archive]:archive format:__git_archive_formats' \
'(- :)'{-l,--list}'[list available archive formats]' \
'(-v --verbose)'{-v,--verbose}'[report progress to stderr]' \
'--mtime=[set modification time of archive entries]:mtime' \
'--prefix=-[prepend the given path prefix to each filename]:path prefix:_directories -r ""' \
'--add-file=[add untracked file to archive]:file:_files' \
'--add-virtual-file=[add untracked file to archive]:path:_files' \
'(-o --output)'{-o+,--output=}'[write archive to specified file]:archive:_files' \
'--worktree-attributes[look for attributes in .gitattributes in working directory too]' \
$backend_args \
'--remote=[archive remote repository]:remote repository:__git_any_repositories' \
'--exec=[path to git-receive-pack on remote]:remote path:_files' \
': :__git_tree_ishs' \
'*: :->file' && ret=0
case $state in
(file)
__git_tree_files ${PREFIX:-.} $line[1] && ret=0
;;
esac
return ret
}
(( $+functions[_git-bisect] )) ||
_git-bisect () {
local curcontext=$curcontext state line ret=1
declare -A opt_args
local good bad
if good=$(_call_program commands git bisect terms --term-good); then
bad=$(_call_program commands git bisect terms --term-bad)
else
good=( good old ) bad=( new bad )
fi
_arguments -C \
'--help[display git-bisect manual page]' \
': :->command' \
'*:: :->option-or-argument' && ret=0
case $state in
(command)
declare -a commands
commands=(
help:'display a short usage description'
start:'reset bisection state and start a new bisection'
${^bad}:'mark current or given revision as bad'
${^good}:'mark current or given revision as good'
skip:'choose a nearby commit'
next:'find next bisection to test and check it out'
reset:'finish bisection search and return to the given branch (or master)'
visualize:'show the remaining revisions in gitk'
view:'show the remaining revisions in gitk'
replay:'replay a bisection log'
terms:'show currently used good/bad terms'
log:'show log of the current bisection'
run:'run evaluation script')
_describe -t commands command commands && ret=0
;;
(option-or-argument)
curcontext=${curcontext%:*}-$line[1]:
case $line[1] in
(start)
_arguments -C \
--term-{good,old}'=[specify alternate term for good revisions]:term' \
--term-{bad,new}'=[specify alternate term for bad revisions]:term' \
'--no-checkout[set BISECT_HEAD reference instead of doing checkout at each iteration]' \
'--first-parent[follow only the first parent commit upon seeing a merge commit]' \
':bad revision:__git_commits' \
'*: :->revision-or-path' && ret=0
case $state in
(revision-or-path)
if compset -N '--' || ! __git_is_committish $line[CURRENT-1]; then
__git_cached_files && ret=0
else
_alternative \
'revisions::__git_revisions' \
'files::__git_cached_files' && ret=0
fi
;;
esac
;;
(${(~j.|.)bad}|${(~j.|.)good}|skip)
# TODO: skip can take revlists.
_arguments \
'*: :__git_commits' && ret=0
;;
(replay)
_arguments \
':log file:_files' && ret=0
;;
(reset)
_arguments \
': :__git_heads' && ret=0
;;
(run)
_arguments \
'*:: : _normal' && ret=0
;;
(terms)
_arguments --term-good --term-bad && ret=0
;;
(view|visualize)
local -a log_options revision_options
__git_setup_log_options
__git_setup_revision_options
_arguments -C -s \
$log_options \
$revision_options && ret=0
;;
(*)
_nothing
;;
esac
;;
esac
return ret
}
(( $+functions[_git-branch] )) ||
_git-branch () {
declare l c m d e
l='--color --no-color -r --remotes -a -v --verbose --abbrev --no-abbrev -l --list --points-at --sort'
c='--create-reflog -f --force -t --track --no-track -u --set-upstream --set-upstream-to --unset-upstream --contains --no-contains --merged --no-merged'
m='-c --copy -C -m --move -M --edit-description --show-current'
d='-d --delete -D'
declare -a dependent_creation_args
if (( words[(I)(-r|--remotes)] == 0 )); then
dependent_creation_args=(
"($l $m $d): :__git_branch_names"
"::start-point:__git_revisions")
fi
declare -a dependent_deletion_args
if (( words[(I)-d] || words[(I)-D] )); then
dependent_creation_args=
dependent_deletion_args=(
'-r[delete only remote-tracking branches]')
if (( words[(I)(-r|--remotes)] )); then
dependent_deletion_args+='*: :__git_ignore_line_inside_arguments __git_remote_branch_names'
else
dependent_deletion_args+='*: :__git_ignore_line_inside_arguments __git_branch_names'
fi
fi
declare -a dependent_modification_args
if (( words[(I)-m] || words[(I)-M] )); then
dependent_creation_args=
dependent_modification_args=(
':old or new branch name:__git_branch_names'
'::new branch name:__git_branch_names')
fi
_arguments -S -s $endopt \
"($c $m $d --no-color :)--color=-[turn on branch coloring]:: :__git_color_whens" \
"($c $m $d : --color)--no-color[turn off branch coloring]" \
"($c $m $d --no-column)--column=-[display tag listing in columns]:: :_git_column_layouts" \
"($c $m $d --column)--no-column[don't display in columns]" \
"($c $m $d)*"{-l,--list}'[list only branches matching glob]:pattern' \
"($c $m -a)"{-r,--remotes}'[list or delete only remote-tracking branches]' \
"($c $m $d : -r --remotes)-a[list both remote-tracking branches and local branches]" \
"($c $m $d : -v -vv --verbose)"{-v,-vv,--verbose}'[show SHA1 and commit subject line for each head]' \
"($c $m $d :)--abbrev=[use specified digits to display object names]:digits" \
"($c $m $d :)--no-abbrev[don't abbreviate sha1s]" \
"(- :)--show-current[show current branch name]" \
"($l $m $d)--create-reflog[create the branch's reflog]" \
"($l $m $d -f --force)"{-f,--force}'[force the creation of a new branch]' \
"($l $m $d --track)-t[setup configuration so that pull merges from the start point]" \
"($l $m $d -t)--track=-[setup configuration so that pull merges from the start point]::upstream tracking:(direct inherit)" \
"($l $m $d)--no-track[override the branch.autosetupmerge configuration variable]" \
"($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)"{-u+,--set-upstream-to=}'[set up configuration so that pull merges]:remote branch:__git_remote_branch_names' \
"($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)--unset-upstream[remove upstream configuration]" \
"($l $m $d)*--contains=[only list branches that contain the specified commit]: :__git_committishs" \
"($l $m $d)*--no-contains=[only list branches that don't contain the specified commit]: :__git_committishs" \
"($l $m $d)--merged=[only list branches that are fully contained by HEAD]: :__git_committishs" \
"($l $m $d)--no-merged=[don't list branches that are fully contained by HEAD]: :__git_committishs" \
"($c $l $m $d)--edit-description[edit branch description]" \
$dependent_creation_args \
"($l $c $d $m)"{-m,--move}"[rename a branch and the corresponding reflog]" \
"($l $c $d $m)-M[rename a branch even if the new branch-name already exists]" \
"--omit-empty[don't output a newline after empty formatted refs]" \
"($l $c $d $m)"{-c,--copy}"[copy a branch and the corresponding reflog]" \
"($l $c $d $m)-C[copy a branch even if the new branch-name already exists]" \
$dependent_modification_args \
"($l $c $m $d)"{-d,--delete}"[delete a fully merged branch]" \
"($l $c $m $d)-D[delete a branch]" \
{-q,--quiet}"[be more quiet]" \
'*--sort=[specify field to sort on]: :__git_ref_sort_keys' \
'--points-at=[only list tags of the given object]: :__git_commits' \
"($c $m $d -i --ignore-case)"{-i,--ignore-case}'[sorting and filtering are case-insensitive]' \
"($l $m $d)--recurse-submodules[recurse through submodules]" \
$dependent_deletion_args
}
(( $+functions[_git-bundle] )) ||
_git-bundle () {
local curcontext=$curcontext state line ret=1
declare -A opt_args
_arguments -C \
': :->command' \
'*:: :->option-or-argument' && ret=0
case $state in
(command)
declare -a commands
commands=(
'create:create a bundle'
'verify:check that a bundle is valid and will apply cleanly'
'list-heads:list references defined in bundle'
'unbundle:unbundle a bundle to repository')
_describe -t commands command commands && ret=0
;;
(option-or-argument)
curcontext=${curcontext%:*}-$line[1]:
case $line[1] in
(create)
if (( CURRENT == 2 )); then
_arguments \
'(-q --quiet)'{-q,--quiet}"[don't show progress]" \
'--progress[show progress meter]' \
\!--all-progress{,-implied} \
'--version=[specify bundle format version]:version:(2 3)' \
':bundle:_files' && ret=0
else
local revision_options
__git_setup_revision_options -d
_arguments -S -s \
$revision_options \
': :_files' \
'*: :__git_commit_ranges2' && ret=0
fi
;;
(verify)
_arguments \
'(-q --quiet)'{-q,--quiet}"[don't show bundle details]" \
':bundle:_files' && ret=0
;;
(list-heads)
_arguments \
':bundle:_files' \
'*: :__git_references' && ret=0
;;
(unbundle)
_arguments \
'--progress[show progress meter]' \
':bundle:_files' \
'*: :__git_references' && ret=0
;;
esac
;;
esac
return ret
}
(( $+functions[_git-version] )) ||
_git-version () {
_arguments -S $endopt \
'--build-options[also print build options]'
}
(( $+functions[_git-check-ignore] )) ||
_git-check-ignore () {
_arguments -s -S $endopt \
'(-q --quiet)'{-q,--quiet}'[do not output anything, just set exit status]' \
'(-v --verbose)'{-v,--verbose}'[output details about the matching pattern (if any) for each pathname]' \
'--stdin[read file names from stdin instead of from the command-line]' \
'-z[make output format machine-parseable and treat input-paths as NUL-separated with --stdin]' \
'(-n --non-matching)'{-n,--non-matching}'[show given paths which do not match any pattern]' \
'--no-index[do not look in the index when undertaking the checks]' \
'*:: :_files'
}
(( $+functions[_git-check-mailmap] )) ||
_git-check-mailmap () {
_arguments -S $endopt \
'--stdin[read contacts from stdin after those given on the command line]'
}
(( $+functions[_git-checkout] )) ||
_git-checkout () {
# TODO: __git_tree_ishs is just stupid. It should be giving us a list of tags
# and perhaps also allow all that just with ^{tree} and so on. Not quite sure
# how to do that, though.
local new_branch_reflog_opt
if (( words[(I)-b|-B|--orphan] )); then
new_branch_reflog_opt="(--patch)-l[create the new branch's reflog]"
fi
local curcontext=$curcontext state line ret=1
declare -A opt_args
_arguments -C -s \
'(-q --quiet)'{-q,--quiet}'[suppress progress reporting]' \
'(-f --force -m --merge --conflict --patch)'{-f,--force}'[force branch switch/ignore unmerged entries]' \
'(-q --quiet -2 --ours -3 --theirs --patch)'{-2,--ours}'[check out stage #2 for unmerged paths]' \
'(-q --quiet -2 --ours -3 --theirs --patch)'{-3,--theirs}'[check out stage #3 for unmerged paths]' \
'( -B --orphan -2 --ours -3 --theirs --conflict --patch -d --detach)-b+[create a new branch based at given commit]: :__git_branch_names' \
'(-b --orphan -2 --ours -3 --theirs --conflict --patch -d --detach)-B+[create or update branch based at given commit]: :__git_branch_names' \
'(--track --no-track --orphan --patch -d --detach)-t[set upstream info for new branch]' \
'(-t --no-track --orphan --patch -d --detach)--track=-[set upstream info for new branch]::configuration:(direct inherit)' \
'(--patch)--no-track[override the branch.autosetupmerge configuration variable]' \
$new_branch_reflog_opt \
'(-b -B -t --track --patch --orphan -d --detach)'{-d,--detach}'[detach the HEAD at named commit]' \
'(-b -B -t --track --patch -d --detach)--orphan=[create a new orphan branch based at given commit]: :__git_branch_names' \
'(-q --quiet -f --force -m --merge --conflict --patch)'{-m,--merge}'[3way merge current branch, working tree and new branch]' \
'(-q --quiet -f --force -m --merge --patch)--conflict=[same as --merge, using given merge style]:style:(merge diff3 zdiff3)' \
'(-)'{-p,--patch}'[interactively select hunks in diff between given tree-ish and working tree]' \
"--ignore-skip-worktree-bits[don't limit pathspecs to sparse entries only]" \
"--no-guess[don't second guess 'git checkout <no-such-branch>']" '!(--no-guess)--guess' \
"--ignore-other-worktrees[don't check if another worktree is holding the given ref]" \
'--recurse-submodules=-[control recursive updating of submodules]::checkout:__git_commits' \
'--no-overlay[remove files from index or working tree that are not in the tree-ish]' \
'(-q --quiet --progress)--no-progress[suppress progress reporting]' \
'--progress[force progress reporting]' \
'(*)--pathspec-from-file=[read pathspec from file]:file:_files' \
'(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \
'(-)--[start file arguments]' \
'*:: :->branch-or-tree-ish-or-file' && ret=0
case $state in
(branch-or-tree-ish-or-file)
# TODO: Something about *:: brings us here when we complete at "-". I
# guess that this makes sense in a way, as we might want to treat it as
# an argument, but I can't find anything in the documentation about this
# behavior.
[[ $line[CURRENT] = -* ]] && return
if (( CURRENT == 1 )) && [[ -z $opt_args[(I)--] ]]; then
# TODO: Allow A...B
local \
tree_ish_arg='tree-ishs::__git_commits_prefer_recent' \
file_arg='modified-files::__git_modified_files'
if [[ -n ${opt_args[(I)-b|-B|--orphan|--detach]} ]]; then
_alternative $tree_ish_arg && ret=0
elif [[ -n $opt_args[(I)--track] ]]; then
_alternative remote-branches::__git_remote_branch_names && ret=0
elif [[ -n ${opt_args[(I)--ours|--theirs|-m|--conflict|--patch|--no-guess]} ]]; then
_alternative $tree_ish_arg $file_arg && ret=0
else
_alternative \
$file_arg \
$tree_ish_arg \
'remote-branch-names-noprefix::__git_remote_branch_names_noprefix' \
&& ret=0
fi
elif [[ -n ${opt_args[(I)-b|-B|-t|--track|--orphan|--detach]} ]]; then
_nothing
elif [[ -n $line[1] ]] && __git_is_treeish ${(Q)line[1]}; then
__git_ignore_line __git_tree_files ${PREFIX:-.} ${(Q)line[1]} && ret=0
else
__git_ignore_line __git_modified_files && ret=0
fi
;;
esac
return ret
}
(( $+functions[_git-cherry-pick] )) ||
_git-cherry-pick () {
local -a git_commit_opts
git_commit_opts=(--all --not HEAD --not)
_arguments \
- init \
'--cleanup=[specify how to strip spaces and #comments from message]:mode:_git_cleanup_modes' \
'--allow-empty[preserve initially empty commits]' \
'--allow-empty-message[allow replaying a commit with an empty message]' \
'--keep-redundant-commits[keep cherry-picked commits that will become empty]' \
'(-e --edit --ff)'{-e,--edit}'[edit commit before committing the cherry-pick]' \
'(--ff)-x[append information about what commit was cherry-picked]' \
'(-m --mainline)'{-m+,--mainline=}'[specify mainline when cherry-picking a merge commit]:parent number' \
'(--no-rerere-autoupdate)--rerere-autoupdate[update index with reused conflict resolution if possible]' \
'(--rerere-autoupdate)--no-rerere-autoupdate' \
'(-n --no-commit --ff)'{-n,--no-commit}'[do not make the actual commit]' \
'(-s --signoff --ff)'{-s,--signoff}'[add Signed-off-by trailer at the end of the commit message]' \
'(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \
"(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \
'*--strategy=[use given merge strategy]:merge strategy:__git_merge_strategies' \
'*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options' \
'(-e --edit -x -n --no-commit -s --signoff)--ff[fast forward, if possible]' \
'*: : __git_commit_ranges -O expl:git_commit_opts' \
- '(sequencer)' \
'--quit[end revert or cherry-pick sequence]' \
'--continue[resume revert or cherry-pick sequence]' \
'--skip[skip current commit and continue]' \
'--abort[cancel revert or cherry-pick sequence]' \
}
(( $+functions[_git-citool] )) ||
_git-citool () {
_nothing
}
(( $+functions[_git-clean] )) ||
_git-clean () {
local curcontext=$curcontext state line ret=1
declare -A opt_args
_arguments -C -S -s $endopt \
'-d[also remove untracked directories]' \
\*{-f,--force}'[required by default; twice, removes untracked nested repositories]' \
'(-i --interactive)'{-i,--interactive}'[show what would be done and clean files interactively]' \
'(-n --dry-run)'{-n,--dry-run}'[only show what would and what would not be removed]' \
'(-q --quiet)'{-q,--quiet}"[don't print names of files removed]" \
'*'{-e+,--exclude=}'[skip files matching specified pattern]:pattern' \
'(-X )-x[also remove ignored files]' \
'( -x)-X[remove only ignored files]' \
'*: :->file' && ret=0
case $state in
(file)
local exclusion ignored_other_files_alt other_files_alt
declare -a exclusions
for spec in $opt_args[-e] $opt_args[--exclude]; do
integer i
for (( i = 1; i <= $#spec; i++ )); do
case $spec[i] in
(\\)
if (( i + 1 <= $#spec )) && [[ $spec[i+1] == : ]]; then
(( i++ ))
exclusion+=:
else
exclusion+=$spec[i]
fi
;;
(:)
exclusions+=(-x $exclusion) exclusion=
;;
(*)
exclusion+=$spec[i]
;;
esac
done
done
[[ -n $exclusion ]] && exclusions+=(-x $exclusion)
if [[ -n ${opt_args[(I)-x|-X]} ]]; then
ignored_other_files_alt="ignored-untracked-files::__git_ignored_other_files $exclusions"
fi
if [[ -z ${opt_args[(I)-X]} ]]; then
other_files_alt="untracked-files::__git_other_files $exclusions"
fi
_alternative \
$ignored_other_files_alt \
$other_files_alt && ret=0
;;
esac
return ret
}
(( $+functions[_git-clone] )) ||
_git-clone () {
local curcontext=$curcontext state line ret=1
declare -A opt_args
# TODO: Argument to -o should be a remote name.
# TODO: Argument to -b should complete branch names in the repository being
# cloned (see __git_references())
_arguments -C -S -s $endopt \
'(-l --local --no-local)'{-l,--local}'[clone locally, hardlink refs and objects if possible]' \
'(-l --local --no-local)--no-local[override --local, as if file:/// URL was given]' \
'--no-hardlinks[copy files instead of hardlinking when doing a local clone]' \
'(-s --shared)'{-s,--shared}'[share the objects with the source repository (warning: see man page)]' \
'(-j --jobs)'{-j+,--jobs=}'[specify number of submodules cloned in parallel]:jobs' \
'--reference[reference repository]:repository:_directories' \
'--reference-if-able[reference repository]:repository:_directories' \
'--dissociate[make the newly-created repository independent of the --reference repository]' \
'(-q --quiet)'{-q,--quiet}'[operate quietly]' \
'(-v --verbose)'{-v,--verbose}'[always display the progressbar]' \
'--progress[output progress even if stderr is not a terminal]' \
"--reject-shallow[don't clone shallow repository]" \
'(-n --no-checkout)'{-n,--no-checkout}'[do not checkout HEAD after clone is complete]' \
'(-o --origin)--bare[make a bare GIT repository]' \
'(--bare)--mirror[clone refs into refs/* instead of refs/remotes/origin/*]' \
'(-o --origin --bare)'{-o+,--origin=}'[use given remote name instead of "origin"]: :__git_guard_branch-name' \
'(-b --branch)'{-b+,--branch=}'[point HEAD to the given branch]: :__git_guard_branch-name' \
'(-u --upload-pack)'{-u+,--upload-pack=}'[specify path to git-upload-pack on remote side]:remote path' \
'--template=[directory to use as a template for the object database]: :_directories' \
'*'{-c,--config}'[<key>=<value> set a configuration variable in the newly created repository]' \
'(--bundle-uri)--depth[create a shallow clone, given number of revisions deep]: :__git_guard_number depth' \
'(--bundle-uri)--shallow-since=[shallow clone since a specific time]:time' \
'(--bundle-uri)*--shallow-exclude=[shallow clone excluding commits reachable from specified remote revision]:revision' \
'(--no-single-branch)--single-branch[clone only history leading up to the main branch or the one specified by -b]' \
'(--single-branch)--no-single-branch[clone history leading up to each branch]' \
"--no-tags[don't clone any tags and make later fetches not follow them]" \
'--shallow-submodules[any cloned submodules will be shallow]' \
'(--recursive --recurse-submodules)'{--recursive,--recurse-submodules}'=-[initialize submodules in the clone]::file:__git_files' \
'--separate-git-dir[place .git dir outside worktree]:path to .git dir:_path_files -/' \
\*--server-option='[send specified string to the server when using protocol version 2]:option' \
'(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' \
'(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' \
'--filter=[object filtering]:filter:_git_rev-list_filters' \
'--also-filter-submodules[apply partial clone filters to submodules]' \
'--remote-submodules[any cloned submodules will use their remote-tracking branch]' \
'--sparse[initialize the sparse-checkout file to start with only the top-level files]' \
'(--depth --shallow-since --shallow-exclude)--bundle-uri=[before fetching, get a bundle from specified location]:uri:_urls' \
': :->repository' \
': :_directories' && ret=0
case $state in
(repository)
if [[ -n ${opt_args[(I)-l|--local|--no-hardlinks|-s|--shared|--reference]} ]]; then
__git_local_repositories && ret=0
else
__git_any_repositories && ret=0
fi
;;
esac
return ret
}
(( $+functions[_git-column] )) ||
_git-column() {
_arguments -s \
'--command=[look up layout mode using in config vars using specified command]:command:(branch clean status tag ui)' \
'--mode=[specify layout mode]: :_git_column_layouts' \
'--raw-mode=[same as --mode but take mode encoded as a number]:mode' \
"--width=[specify the terminal width]:width [${COLUMNS:-80}]" \
'--indent=[specify string to be printed at the beginning of each line]:string' \
'--nl=[specify string to be printed at the end of each line, including newline character]:string' \
'--padding=[specify number of spaces between columns]:spaces [1]'
}
(( $+functions[_git-commit] )) ||
_git-commit () {
local amend_opt='--amend[amend the tip of the current branch]'
if __git_is_initial_commit || __git_is_in_middle_of_merge; then
amend_opt=
fi
local reset_author_opt=
if (( words[(I)-C|--reuse-message(=*|)|-c|--reedit-message(=*|)|--amend] )); then
reset_author_opt='(--author)--reset-author[make committer the author of the commit]'
fi
# TODO: --interactive isn't explicitly listed in the documentation.
_arguments -S -s $endopt \
'(-a --all --interactive -o --only -i --include *)'{-a,--all}'[stage all modified and deleted paths]' \
'--fixup=[construct a commit message for use with rebase --autosquash]:commit to be amended:_git_fixup' \
'--squash=[construct a commit message for use with rebase --autosquash]:commit to be amended:__git_recent_commits' \
$reset_author_opt \
'( --porcelain --dry-run)--short[dry run with short output format]' \
'--branch[show branch information]' \
'!(--no-ahead-behind)--ahead-behind' \
"--no-ahead-behind[don't display detailed ahead/behind counts relative to upstream branch]" \
'(--short --dry-run)--porcelain[dry run with machine-readable output format]' \
'(--short --porcelain --dry-run -z --null)'{-z,--null}'[dry run with NULL-separated output format]' \
{-p,--patch}'[use the interactive patch selection interface to choose which changes to commit]' \
'(--reset-author)--author[override the author name used in the commit]:author name' \
'--date=[override the author date used in the commit]:date' \
'*--trailer=[add custom trailer(s)]:trailer:__git_trailers_tokens' \
'(-s --signoff)'{-s,--signoff}'[add Signed-off-by trailer at the end of the commit message]' \
'(-n --no-verify)'{-n,--no-verify}'[bypass pre-commit and commit-msg hooks]' \
'--allow-empty[allow recording an empty commit]' \
'--allow-empty-message[allow recording a commit with an empty message]' \
'--cleanup=[specify how the commit message should be cleaned up]:mode:_git_cleanup_modes' \
'(-e --edit --no-edit)'{-e,--edit}'[edit the commit message before committing]' \
'(-e --edit --no-edit)--no-edit[do not edit the commit message before committing]' \
'--no-post-rewrite[bypass the post-rewrite hook]' \
'(-a --all --interactive -o --only)*'{-i,--include}'[update the given files and commit the whole index]' \
'(-a --all --interactive -i --include)*'{-o,--only}'[commit only the given files]' \
'(-u --untracked-files)'{-u-,--untracked-files=-}'[show files in untracked directories]::mode:((no\:"show no untracked files"
normal\:"show untracked files and directories"
all\:"show individual files in untracked directories"))' \
'(*)--pathspec-from-file=[read pathspec from file]:file:_files' \
'(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \
'(-q --quiet -v --verbose)'{-v,--verbose}'[show unified diff of all file changes]' \
'(-q --quiet -v --verbose)'{-q,--quiet}'[suppress commit summary message]' \
'--dry-run[only show list of paths that are to be committed or not, and any untracked]' \
'( --no-status)--status[include the output of git status in the commit message template]' \
'(--status )--no-status[do not include the output of git status in the commit message template]' \
'(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=}'[GPG-sign the commit]::key id' \
"(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \
'(-a --all --interactive -o --only -i --include *)--interactive[interactively update paths in the index file]' \
$amend_opt \
'*: :__git_ignore_line_inside_arguments __git_changed_files' \
- '(message)' \
{-C+,--reuse-message=}'[use existing commit object with same log message]: :__git_commits' \
{-c+,--reedit-message=}'[use existing commit object and edit log message]: :__git_commits' \
{-F+,--file=}'[read commit message from given file]: :_files' \
\*{-m+,--message=}'[use the given message as the commit message]:message' \
{-t+,--template=}'[use file as a template commit message]:template:_files'
}
(( $+functions[_git-describe] )) ||
_git-describe () {
_arguments -S -s $endopt \
'(*)--dirty=-[describe HEAD, adding mark if dirty]::mark' \
'(*)--broken=-[describe HEAD, adding mark if broken]::mark' \
'--all[use any ref found in "$GIT_DIR/refs/"]' \
'--tags[use any ref found in "$GIT_DIR/refs/tags"]' \
'(--tags)--contains[find the tag after the commit instead of before]' \
'--abbrev=[use specified digits to display object names]:digits' \
'( --exact-match)--candidates=[consider up to given number of candidates]: :__git_guard_number "number of candidates"' \
'(--candidates )--exact-match[only output exact matches, same as --candidates=0]' \
'--debug[display information about the searching strategy]' \
'--long[always show full format, even for exact matches]' \
'*--match=[only consider tags matching glob pattern]:pattern' \
"*--exclude=[don't consider tags matching glob pattern]:pattern" \
'--always[show uniquely abbreviated commit object as fallback]' \
'--first-parent[follow only the first parent of merge commits]' \
'*: :__git_committishs'
}
(( $+functions[_git-diff] )) ||
_git-diff () {
local curcontext=$curcontext state line ret=1
declare -A opt_args
local -a diff_options diff_stage_options
__git_setup_diff_options
__git_setup_diff_stage_options
_arguments -C -s $endopt \
$* \
$diff_options \
'--exit-code[report exit code 1 if differences, 0 otherwise]' \
'(--exit-code)--quiet[disable all output]' \
$diff_stage_options \
'(--cached --staged)--no-index[show diff between two paths on the filesystem]' \
'(--cached --staged --no-index)'{--cached,--staged}'[show diff between index and named commit]' \
'(-)--[start file arguments]' \
'*:: :->from-to-file' && ret=0
case $state in
(from-to-file)
# If "--" is part of $opt_args, this means it was specified before any
# $words arguments. This means that no heads are specified in front, so
# we need to complete *changed* files only.
if [[ -n ${opt_args[(I)--]} ]]; then
if [[ -n ${opt_args[(I)--cached|--staged]} ]]; then
__git_changed-in-index_files && ret=0
else
__git_changed-in-working-tree_files && ret=0
fi
return ret
fi
# If "--no-index" was given, only file paths need to be completed.
if [[ -n ${opt_args[(I)--no-index]} ]]; then
_alternative 'files::_files' && ret=0
return ret
fi
# Otherwise, more complex conditions need to be checked.
case $CURRENT in
(2)
# Check if first argument is something special. In case of committish ranges and committishs offer a full list compatible completions.
if __git_is_committish_range $line[1]; then
# Example: git diff branch1..branch2 <tab>
__git_tree_files ${PREFIX:-.} $(__git_committish_range_last $line[1]) && ret=0
elif __git_is_committish $line[1] || __git_is_treeish $line[1]; then
local files_alt='files::__git_tree_files ${PREFIX:-.} HEAD'
[[ $line[1] = (HEAD|@) ]] &&
files_alt='files::__git_changed_files'
# Example: git diff branch1 <tab>
_alternative \
'commits::__git_commits' \
'blobs-and-trees-in-treeish::__git_blobs_and_trees_in_treeish' \
$files_alt && ret=0
elif __git_is_blob $line[1]; then
_alternative \
'files::__git_cached_files' \
'blobs::__git_blobs' && ret=0
elif [[ -n ${opt_args[(I)--cached|--staged]} ]]; then
# Example: git diff --cached file1 <tab>
__git_changed-in-index_files && ret=0
fi
;&
(1)
local files_alt='files::__git_changed-in-working-tree_files'
if [[ -n ${opt_args[(I)--cached|--staged]} ]]; then
files_alt='files::__git_changed-in-index_files'
fi
_alternative \
'commit-ranges::__git_commit_ranges' \
'blobs-and-trees-in-treeish::__git_blobs_and_trees_in_treeish' \
$files_alt \
'blobs::__git_blobs ' && ret=0
;;
(*)
if __git_is_committish_range $line[1]; then
# Example: git diff branch1..branch2 file1 <tab>
__git_tree_files ${PREFIX:-.} $(__git_committish_range_last $line[1]) && ret=0
elif { __git_is_committish $line[1] && __git_is_committish $line[2] } ||
__git_is_treeish $line[2]; then
# Example: git diff branch1 branch2 <tab>
__git_tree_files ${PREFIX:-.} $line[2] && ret=0
elif [[ $line[1] = (HEAD|@) ]]; then
# Example: git diff @ file1 <tab>
# Example: git diff HEAD -- <tab>
__git_ignore_line __git_changed_files && ret=0
elif __git_is_committish $line[1] || __git_is_treeish $line[1]; then
# Example: git diff branch file1 <tab>
# Example: git diff branch -- f<tab>
__git_tree_files ${PREFIX:-.} HEAD && ret=0
elif __git_is_blob $line[1] && __git_is_blob $line[2]; then
_nothing
elif [[ -n ${opt_args[(I)--cached|--staged]} ]]; then
# Example: git diff --cached file1 file2 <tab>
__git_changed-in-index_files && ret=0
else
# Example: git diff file1 file2 <tab>
__git_changed-in-working-tree_files && ret=0
fi
;;
esac
;;
esac
return ret
}
(( $+functions[_git-fetch] )) ||
_git-fetch () {
local curcontext=$curcontext state line ret=1
declare -A opt_args
local -a fetch_options
__git_setup_fetch_options
_arguments -C -S -s $endopt \
$fetch_options \
'--atomic[use atomic transaction to update references]' \
'(--all -m --multiple)'{-m,--multiple}'[fetch from multiple remotes]' \
'(-n --no-tags -t --tags)'{-n,--no-tags}'[disable automatic tag following]' \
'--prefetch[modify the refspec to place all refs within refs/prefetch/]' \
'--refetch[fetch all objects as a fresh clone would]' \
'(-P --prune-tags)'{-P,--prune-tags}'[prune local tags no longer on remote and clobber changed tags]' \
'--write-fetch-head[write fetched references to the FETCH_HEAD file]' \
"--negotiate-only[don't fetch a packfile; instead, print ancestors of negotiation tips]" \
'--filter=[object filtering]:filter:_git_rev-list_filters' \
'(--auto-maintenance --auto-gc)'--auto-{maintenance,gc}"[run 'maintenance --auto' after fetching]" \
'--write-commit-graph[write the commit-graph after fetching]' \
'--stdin[accept refspecs from stdin]' \
'*:: :->repository-or-group-or-refspec' && ret=0
case $state in
(repository-or-group-or-refspec)
if (( CURRENT > 1 )) && [[ -z ${opt_args[(I)--multiple]} ]]; then
__git_ref_specs_fetchy && ret=0
else
_alternative \
'remotes::__git_remotes' \
'remotes-groups::__git_remotes_groups' \
'local-repositories::__git_local_repositories' \
'remote-repositories::__git_remote_repositories' && ret=0
fi
;;
esac
return ret
}
(( $+functions[_git-format-patch] )) ||
_git-format-patch () {
local curcontext=$curcontext state line ret=1
declare -A opt_args
local -a diff_options
__git_setup_diff_options
# TODO: -- is wrong.
# TODO: Should filter out --name-only, --name-status, and --check from
# $diff_options.
_arguments -C -S -s $endopt \
$diff_options \
'--[limit the number of patches to prepare]: :__git_guard_number "number of patches to prepare"' \
'(-o --output-directory --stdout)'{-o+,--output-directory=}'[store resulting files in given directory]: :_directories' \
'(-n --numbered -N --no-numbered -k --keep-subject)'{-n,--numbered}'[name output in \[PATCH n/m\] format]' \
'(-n --numbered -N --no-numbered -k --keep-subject)'{-N,--no-numbered}'[name output in \[PATCH\] format]' \
'--start-number=[start numbering patches at given number]: :__git_guard_number "patch number"' \
'--numbered-files[use only number for file name]' \
'(-n --numbered -N --no-numbered -k --keep-subject --rfc --subject-prefix)'{-k,--keep-subject}"[don't strip/add \[PATCH\] from the first line of the commit message]" \
'(-s --signoff)'{-s,--signoff}'[add Signed-off-by: trailer to the commit message]' \
'(-o --output-directory)--stdout[output the generated mbox on standard output (implies --mbox)]' \
'( --no-attach --inline)--attach=-[create attachments instead of inlining patches]::boundary' \
'(--attach --inline)--no-attach[disable creation of attachments]' \
'(--attach --no-attach )--inline=-[inline patches]::boundary' \
'( --no-thread)--thread=-[make the second and subsequent mails refer to the first]::style:((shallow\:"all refer to the first"
deep\:"each refers to the previous"))' \
'(--thread )--no-thread[do not thread messages]' \
'--in-reply-to=[make the first mail a reply to the given message]:message id' \
'--ignore-if-in-upstream[do not include a patch that matches a commit in the given range]' \
'(-v --reroll-count)'{-v+,--reroll-count=}'[mark the series as the <n>-th iteration of the topic]: :__git_guard_number iteration' \
'--filename-max-length=[specify max length of output filename]:length' \
'(-k --keep-subject --subject-prefix)--rfc[use \[RFC PATCH\] instead of \[PATCH\]]' \
"--cover-from-description=[generate parts of a cover letter based on a branch's description]:mode:(message default subject auto none)" \
'(-k --keep-subject --rfc)--subject-prefix=[use the given prefix instead of \[PATCH\]]:prefix' \
'*--to=[add To: header to email headers]: :_email_addresses' \
'*--cc=[add Cc: header to email headers]: :_email_addresses' \
'--from=[add From: header to email headers]: :_email_addresses' \
'*--add-header=[add an arbitrary header to email headers]:header' \
'--cover-letter[generate a cover letter template]' \
'--notes=[append notes for the commit after the three-dash line]:: :__git_notes_refs' \
'( --no-signature --signature-file)--signature=[add a signature]:signature' \
'(--signature --signature-file)--no-signature[do not add a signature]' \
'(--signature --no-signature )--signature-file=[use contents of file as signature]' \
'--suffix=[use the given suffix for filenames]:filename suffix' \
'(-q --quiet)'{-q,--quiet}'[suppress the output of the names of generated files]' \
'--no-binary[do not output contents of changes in binary files, only note that they differ]' \
'--root[treat the revision argument as a range]' \
'--zero-commit[output all-zero hash in From header]' \
'--progress[show progress while generating patches]' \
'--interdiff=[insert interdiff against previous patch series in cover letter or single patch]:reference to tip of previous series:__git_revisions' \
'--range-diff=[insert range-diff against previous patch series in cover letter or single patch]:reference to tip ot previous series:__git_revisions' \
'--creation-factor=[for range-diff, specify weighting for creation]:weighting (percent)' \
'--force-in-body-from[show in-body From: even if identical to the e-mail header]' \
': :->commit-or-commit-range' && ret=0
case $state in
(commit-or-commit-range)
if [[ -n ${opt_args[(I)--root]} ]]; then
__git_commits && ret=0
else
__git_commit_ranges && ret=0
fi