@@ -144,6 +144,26 @@ __git_complete_file ()
144144 esac
145145}
146146
147+ __git_complete_revlist ()
148+ {
149+ local pfx cur=" ${COMP_WORDS[COMP_CWORD]} "
150+ case " $cur " in
151+ * ...* )
152+ pfx=" ${cur% ...* } ..."
153+ cur=" ${cur#* ...} "
154+ COMPREPLY=($( compgen -P " $pfx " -W " $( __git_refs) " -- " $cur " ) )
155+ ;;
156+ * ..* )
157+ pfx=" ${cur% ..* } .."
158+ cur=" ${cur#* ..} "
159+ COMPREPLY=($( compgen -P " $pfx " -W " $( __git_refs) " -- " $cur " ) )
160+ ;;
161+ * )
162+ COMPREPLY=($( compgen -W " $( __git_refs) " -- " $cur " ) )
163+ ;;
164+ esac
165+ }
166+
147167__git_commands ()
148168{
149169 local i IFS=" " $' \n '
@@ -290,6 +310,26 @@ _git_fetch ()
290310 esac
291311}
292312
313+ _git_format_patch ()
314+ {
315+ local cur=" ${COMP_WORDS[COMP_CWORD]} "
316+ case " $cur " in
317+ --* )
318+ COMPREPLY=($( compgen -W "
319+ --stdout --attach --thread
320+ --output-directory
321+ --numbered --start-number
322+ --keep-subject
323+ --signoff
324+ --in-reply-to=
325+ --full-index --binary
326+ " -- " $cur " ) )
327+ return
328+ ;;
329+ esac
330+ __git_complete_revlist
331+ }
332+
293333_git_ls_remote ()
294334{
295335 local cur=" ${COMP_WORDS[COMP_CWORD]} "
@@ -303,22 +343,7 @@ _git_ls_tree ()
303343
304344_git_log ()
305345{
306- local pfx cur=" ${COMP_WORDS[COMP_CWORD]} "
307- case " $cur " in
308- * ...* )
309- pfx=" ${cur% ...* } ..."
310- cur=" ${cur#* ...} "
311- COMPREPLY=($( compgen -P " $pfx " -W " $( __git_refs) " -- " $cur " ) )
312- ;;
313- * ..* )
314- pfx=" ${cur% ..* } .."
315- cur=" ${cur#* ..} "
316- COMPREPLY=($( compgen -P " $pfx " -W " $( __git_refs) " -- " $cur " ) )
317- ;;
318- * )
319- COMPREPLY=($( compgen -W " $( __git_refs) " -- " $cur " ) )
320- ;;
321- esac
346+ __git_complete_revlist
322347}
323348
324349_git_merge ()
@@ -450,6 +475,7 @@ _git ()
450475 diff) _git_diff ;;
451476 diff-tree) _git_diff_tree ;;
452477 fetch) _git_fetch ;;
478+ format-patch) _git_format_patch ;;
453479 log) _git_log ;;
454480 ls-remote) _git_ls_remote ;;
455481 ls-tree) _git_ls_tree ;;
@@ -480,6 +506,7 @@ complete -o default -F _git_checkout git-checkout
480506complete -o default -o nospace -F _git_diff git-diff
481507complete -o default -F _git_diff_tree git-diff-tree
482508complete -o default -o nospace -F _git_fetch git-fetch
509+ complete -o default -o nospace -F _git_format_patch git-format-patch
483510complete -o default -o nospace -F _git_log git-log
484511complete -o default -F _git_ls_remote git-ls-remote
485512complete -o default -o nospace -F _git_ls_tree git-ls-tree
@@ -503,6 +530,7 @@ complete -o default -F _git_branch git-branch.exe
503530complete -o default -o nospace -F _git_cat_file git-cat-file.exe
504531complete -o default -o nospace -F _git_diff git-diff.exe
505532complete -o default -o nospace -F _git_diff_tree git-diff-tree.exe
533+ complete -o default -o nospace -F _git_format_patch git-format-patch.exe
506534complete -o default -o nospace -F _git_log git-log.exe
507535complete -o default -o nospace -F _git_ls_tree git-ls-tree.exe
508536complete -o default -F _git_merge_base git-merge-base.exe
0 commit comments