@@ -119,148 +119,6 @@ static int opt_show_forced_updates = -1;
119119static const char * set_upstream ;
120120static struct strvec opt_fetch = STRVEC_INIT ;
121121
122- static struct option pull_options [] = {
123- /* Shared options */
124- OPT__VERBOSITY (& opt_verbosity ),
125- OPT_PASSTHRU (0 , "progress" , & opt_progress , NULL ,
126- N_ ("force progress reporting" ),
127- PARSE_OPT_NOARG ),
128- OPT_CALLBACK_F (0 , "recurse-submodules" ,
129- & recurse_submodules_cli , N_ ("on-demand" ),
130- N_ ("control for recursive fetching of submodules" ),
131- PARSE_OPT_OPTARG , option_fetch_parse_recurse_submodules ),
132-
133- /* Options passed to git-merge or git-rebase */
134- OPT_GROUP (N_ ("Options related to merging" )),
135- OPT_CALLBACK_F ('r' , "rebase" , & opt_rebase ,
136- "(false|true|merges|interactive)" ,
137- N_ ("incorporate changes by rebasing rather than merging" ),
138- PARSE_OPT_OPTARG , parse_opt_rebase ),
139- OPT_PASSTHRU ('n' , NULL , & opt_diffstat , NULL ,
140- N_ ("do not show a diffstat at the end of the merge" ),
141- PARSE_OPT_NOARG | PARSE_OPT_NONEG ),
142- OPT_PASSTHRU (0 , "stat" , & opt_diffstat , NULL ,
143- N_ ("show a diffstat at the end of the merge" ),
144- PARSE_OPT_NOARG ),
145- OPT_PASSTHRU (0 , "summary" , & opt_diffstat , NULL ,
146- N_ ("(synonym to --stat)" ),
147- PARSE_OPT_NOARG | PARSE_OPT_HIDDEN ),
148- OPT_PASSTHRU (0 , "compact-summary" , & opt_diffstat , NULL ,
149- N_ ("show a compact-summary at the end of the merge" ),
150- PARSE_OPT_NOARG ),
151- OPT_PASSTHRU (0 , "log" , & opt_log , N_ ("n" ),
152- N_ ("add (at most <n>) entries from shortlog to merge commit message" ),
153- PARSE_OPT_OPTARG ),
154- OPT_PASSTHRU (0 , "signoff" , & opt_signoff , NULL ,
155- N_ ("add a Signed-off-by trailer" ),
156- PARSE_OPT_OPTARG ),
157- OPT_PASSTHRU (0 , "squash" , & opt_squash , NULL ,
158- N_ ("create a single commit instead of doing a merge" ),
159- PARSE_OPT_NOARG ),
160- OPT_PASSTHRU (0 , "commit" , & opt_commit , NULL ,
161- N_ ("perform a commit if the merge succeeds (default)" ),
162- PARSE_OPT_NOARG ),
163- OPT_PASSTHRU (0 , "edit" , & opt_edit , NULL ,
164- N_ ("edit message before committing" ),
165- PARSE_OPT_NOARG ),
166- OPT_CLEANUP (& cleanup_arg ),
167- OPT_PASSTHRU (0 , "ff" , & opt_ff , NULL ,
168- N_ ("allow fast-forward" ),
169- PARSE_OPT_NOARG ),
170- OPT_PASSTHRU (0 , "ff-only" , & opt_ff , NULL ,
171- N_ ("abort if fast-forward is not possible" ),
172- PARSE_OPT_NOARG | PARSE_OPT_NONEG ),
173- OPT_PASSTHRU (0 , "verify" , & opt_verify , NULL ,
174- N_ ("control use of pre-merge-commit and commit-msg hooks" ),
175- PARSE_OPT_NOARG ),
176- OPT_PASSTHRU (0 , "verify-signatures" , & opt_verify_signatures , NULL ,
177- N_ ("verify that the named commit has a valid GPG signature" ),
178- PARSE_OPT_NOARG ),
179- OPT_BOOL (0 , "autostash" , & opt_autostash ,
180- N_ ("automatically stash/stash pop before and after" )),
181- OPT_PASSTHRU_ARGV ('s' , "strategy" , & opt_strategies , N_ ("strategy" ),
182- N_ ("merge strategy to use" ),
183- 0 ),
184- OPT_PASSTHRU_ARGV ('X' , "strategy-option" , & opt_strategy_opts ,
185- N_ ("option=value" ),
186- N_ ("option for selected merge strategy" ),
187- 0 ),
188- OPT_PASSTHRU ('S' , "gpg-sign" , & opt_gpg_sign , N_ ("key-id" ),
189- N_ ("GPG sign commit" ),
190- PARSE_OPT_OPTARG ),
191- OPT_SET_INT (0 , "allow-unrelated-histories" ,
192- & opt_allow_unrelated_histories ,
193- N_ ("allow merging unrelated histories" ), 1 ),
194-
195- /* Options passed to git-fetch */
196- OPT_GROUP (N_ ("Options related to fetching" )),
197- OPT_PASSTHRU (0 , "all" , & opt_all , NULL ,
198- N_ ("fetch from all remotes" ),
199- PARSE_OPT_NOARG ),
200- OPT_PASSTHRU ('a' , "append" , & opt_append , NULL ,
201- N_ ("append to .git/FETCH_HEAD instead of overwriting" ),
202- PARSE_OPT_NOARG ),
203- OPT_PASSTHRU (0 , "upload-pack" , & opt_upload_pack , N_ ("path" ),
204- N_ ("path to upload pack on remote end" ),
205- 0 ),
206- OPT__FORCE (& opt_force , N_ ("force overwrite of local branch" ), 0 ),
207- OPT_PASSTHRU ('t' , "tags" , & opt_tags , NULL ,
208- N_ ("fetch all tags and associated objects" ),
209- PARSE_OPT_NOARG ),
210- OPT_PASSTHRU ('p' , "prune" , & opt_prune , NULL ,
211- N_ ("prune remote-tracking branches no longer on remote" ),
212- PARSE_OPT_NOARG ),
213- OPT_PASSTHRU ('j' , "jobs" , & max_children , N_ ("n" ),
214- N_ ("number of submodules pulled in parallel" ),
215- PARSE_OPT_OPTARG ),
216- OPT_BOOL (0 , "dry-run" , & opt_dry_run ,
217- N_ ("dry run" )),
218- OPT_PASSTHRU ('k' , "keep" , & opt_keep , NULL ,
219- N_ ("keep downloaded pack" ),
220- PARSE_OPT_NOARG ),
221- OPT_PASSTHRU (0 , "depth" , & opt_depth , N_ ("depth" ),
222- N_ ("deepen history of shallow clone" ),
223- 0 ),
224- OPT_PASSTHRU_ARGV (0 , "shallow-since" , & opt_fetch , N_ ("time" ),
225- N_ ("deepen history of shallow repository based on time" ),
226- 0 ),
227- OPT_PASSTHRU_ARGV (0 , "shallow-exclude" , & opt_fetch , N_ ("ref" ),
228- N_ ("deepen history of shallow clone, excluding ref" ),
229- 0 ),
230- OPT_PASSTHRU_ARGV (0 , "deepen" , & opt_fetch , N_ ("n" ),
231- N_ ("deepen history of shallow clone" ),
232- 0 ),
233- OPT_PASSTHRU (0 , "unshallow" , & opt_unshallow , NULL ,
234- N_ ("convert to a complete repository" ),
235- PARSE_OPT_NONEG | PARSE_OPT_NOARG ),
236- OPT_PASSTHRU (0 , "update-shallow" , & opt_update_shallow , NULL ,
237- N_ ("accept refs that update .git/shallow" ),
238- PARSE_OPT_NOARG ),
239- OPT_PASSTHRU (0 , "refmap" , & opt_refmap , N_ ("refmap" ),
240- N_ ("specify fetch refmap" ),
241- PARSE_OPT_NONEG ),
242- OPT_PASSTHRU_ARGV ('o' , "server-option" , & opt_fetch ,
243- N_ ("server-specific" ),
244- N_ ("option to transmit" ),
245- 0 ),
246- OPT_PASSTHRU ('4' , "ipv4" , & opt_ipv4 , NULL ,
247- N_ ("use IPv4 addresses only" ),
248- PARSE_OPT_NOARG ),
249- OPT_PASSTHRU ('6' , "ipv6" , & opt_ipv6 , NULL ,
250- N_ ("use IPv6 addresses only" ),
251- PARSE_OPT_NOARG ),
252- OPT_PASSTHRU_ARGV (0 , "negotiation-tip" , & opt_fetch , N_ ("revision" ),
253- N_ ("report that we have only objects reachable from this object" ),
254- 0 ),
255- OPT_BOOL (0 , "show-forced-updates" , & opt_show_forced_updates ,
256- N_ ("check for forced-updates on all updated branches" )),
257- OPT_PASSTHRU (0 , "set-upstream" , & set_upstream , NULL ,
258- N_ ("set upstream for git pull/fetch" ),
259- PARSE_OPT_NOARG ),
260-
261- OPT_END ()
262- };
263-
264122/**
265123 * Pushes "-q" or "-v" switches into arr to match the opt_verbosity level.
266124 */
@@ -1008,6 +866,147 @@ int cmd_pull(int argc,
1008866 int can_ff ;
1009867 int divergent ;
1010868 int ret ;
869+ static struct option pull_options [] = {
870+ /* Shared options */
871+ OPT__VERBOSITY (& opt_verbosity ),
872+ OPT_PASSTHRU (0 , "progress" , & opt_progress , NULL ,
873+ N_ ("force progress reporting" ),
874+ PARSE_OPT_NOARG ),
875+ OPT_CALLBACK_F (0 , "recurse-submodules" ,
876+ & recurse_submodules_cli , N_ ("on-demand" ),
877+ N_ ("control for recursive fetching of submodules" ),
878+ PARSE_OPT_OPTARG , option_fetch_parse_recurse_submodules ),
879+
880+ /* Options passed to git-merge or git-rebase */
881+ OPT_GROUP (N_ ("Options related to merging" )),
882+ OPT_CALLBACK_F ('r' , "rebase" , & opt_rebase ,
883+ "(false|true|merges|interactive)" ,
884+ N_ ("incorporate changes by rebasing rather than merging" ),
885+ PARSE_OPT_OPTARG , parse_opt_rebase ),
886+ OPT_PASSTHRU ('n' , NULL , & opt_diffstat , NULL ,
887+ N_ ("do not show a diffstat at the end of the merge" ),
888+ PARSE_OPT_NOARG | PARSE_OPT_NONEG ),
889+ OPT_PASSTHRU (0 , "stat" , & opt_diffstat , NULL ,
890+ N_ ("show a diffstat at the end of the merge" ),
891+ PARSE_OPT_NOARG ),
892+ OPT_PASSTHRU (0 , "summary" , & opt_diffstat , NULL ,
893+ N_ ("(synonym to --stat)" ),
894+ PARSE_OPT_NOARG | PARSE_OPT_HIDDEN ),
895+ OPT_PASSTHRU (0 , "compact-summary" , & opt_diffstat , NULL ,
896+ N_ ("show a compact-summary at the end of the merge" ),
897+ PARSE_OPT_NOARG ),
898+ OPT_PASSTHRU (0 , "log" , & opt_log , N_ ("n" ),
899+ N_ ("add (at most <n>) entries from shortlog to merge commit message" ),
900+ PARSE_OPT_OPTARG ),
901+ OPT_PASSTHRU (0 , "signoff" , & opt_signoff , NULL ,
902+ N_ ("add a Signed-off-by trailer" ),
903+ PARSE_OPT_OPTARG ),
904+ OPT_PASSTHRU (0 , "squash" , & opt_squash , NULL ,
905+ N_ ("create a single commit instead of doing a merge" ),
906+ PARSE_OPT_NOARG ),
907+ OPT_PASSTHRU (0 , "commit" , & opt_commit , NULL ,
908+ N_ ("perform a commit if the merge succeeds (default)" ),
909+ PARSE_OPT_NOARG ),
910+ OPT_PASSTHRU (0 , "edit" , & opt_edit , NULL ,
911+ N_ ("edit message before committing" ),
912+ PARSE_OPT_NOARG ),
913+ OPT_CLEANUP (& cleanup_arg ),
914+ OPT_PASSTHRU (0 , "ff" , & opt_ff , NULL ,
915+ N_ ("allow fast-forward" ),
916+ PARSE_OPT_NOARG ),
917+ OPT_PASSTHRU (0 , "ff-only" , & opt_ff , NULL ,
918+ N_ ("abort if fast-forward is not possible" ),
919+ PARSE_OPT_NOARG | PARSE_OPT_NONEG ),
920+ OPT_PASSTHRU (0 , "verify" , & opt_verify , NULL ,
921+ N_ ("control use of pre-merge-commit and commit-msg hooks" ),
922+ PARSE_OPT_NOARG ),
923+ OPT_PASSTHRU (0 , "verify-signatures" , & opt_verify_signatures , NULL ,
924+ N_ ("verify that the named commit has a valid GPG signature" ),
925+ PARSE_OPT_NOARG ),
926+ OPT_BOOL (0 , "autostash" , & opt_autostash ,
927+ N_ ("automatically stash/stash pop before and after" )),
928+ OPT_PASSTHRU_ARGV ('s' , "strategy" , & opt_strategies , N_ ("strategy" ),
929+ N_ ("merge strategy to use" ),
930+ 0 ),
931+ OPT_PASSTHRU_ARGV ('X' , "strategy-option" , & opt_strategy_opts ,
932+ N_ ("option=value" ),
933+ N_ ("option for selected merge strategy" ),
934+ 0 ),
935+ OPT_PASSTHRU ('S' , "gpg-sign" , & opt_gpg_sign , N_ ("key-id" ),
936+ N_ ("GPG sign commit" ),
937+ PARSE_OPT_OPTARG ),
938+ OPT_SET_INT (0 , "allow-unrelated-histories" ,
939+ & opt_allow_unrelated_histories ,
940+ N_ ("allow merging unrelated histories" ), 1 ),
941+
942+ /* Options passed to git-fetch */
943+ OPT_GROUP (N_ ("Options related to fetching" )),
944+ OPT_PASSTHRU (0 , "all" , & opt_all , NULL ,
945+ N_ ("fetch from all remotes" ),
946+ PARSE_OPT_NOARG ),
947+ OPT_PASSTHRU ('a' , "append" , & opt_append , NULL ,
948+ N_ ("append to .git/FETCH_HEAD instead of overwriting" ),
949+ PARSE_OPT_NOARG ),
950+ OPT_PASSTHRU (0 , "upload-pack" , & opt_upload_pack , N_ ("path" ),
951+ N_ ("path to upload pack on remote end" ),
952+ 0 ),
953+ OPT__FORCE (& opt_force , N_ ("force overwrite of local branch" ), 0 ),
954+ OPT_PASSTHRU ('t' , "tags" , & opt_tags , NULL ,
955+ N_ ("fetch all tags and associated objects" ),
956+ PARSE_OPT_NOARG ),
957+ OPT_PASSTHRU ('p' , "prune" , & opt_prune , NULL ,
958+ N_ ("prune remote-tracking branches no longer on remote" ),
959+ PARSE_OPT_NOARG ),
960+ OPT_PASSTHRU ('j' , "jobs" , & max_children , N_ ("n" ),
961+ N_ ("number of submodules pulled in parallel" ),
962+ PARSE_OPT_OPTARG ),
963+ OPT_BOOL (0 , "dry-run" , & opt_dry_run ,
964+ N_ ("dry run" )),
965+ OPT_PASSTHRU ('k' , "keep" , & opt_keep , NULL ,
966+ N_ ("keep downloaded pack" ),
967+ PARSE_OPT_NOARG ),
968+ OPT_PASSTHRU (0 , "depth" , & opt_depth , N_ ("depth" ),
969+ N_ ("deepen history of shallow clone" ),
970+ 0 ),
971+ OPT_PASSTHRU_ARGV (0 , "shallow-since" , & opt_fetch , N_ ("time" ),
972+ N_ ("deepen history of shallow repository based on time" ),
973+ 0 ),
974+ OPT_PASSTHRU_ARGV (0 , "shallow-exclude" , & opt_fetch , N_ ("ref" ),
975+ N_ ("deepen history of shallow clone, excluding ref" ),
976+ 0 ),
977+ OPT_PASSTHRU_ARGV (0 , "deepen" , & opt_fetch , N_ ("n" ),
978+ N_ ("deepen history of shallow clone" ),
979+ 0 ),
980+ OPT_PASSTHRU (0 , "unshallow" , & opt_unshallow , NULL ,
981+ N_ ("convert to a complete repository" ),
982+ PARSE_OPT_NONEG | PARSE_OPT_NOARG ),
983+ OPT_PASSTHRU (0 , "update-shallow" , & opt_update_shallow , NULL ,
984+ N_ ("accept refs that update .git/shallow" ),
985+ PARSE_OPT_NOARG ),
986+ OPT_PASSTHRU (0 , "refmap" , & opt_refmap , N_ ("refmap" ),
987+ N_ ("specify fetch refmap" ),
988+ PARSE_OPT_NONEG ),
989+ OPT_PASSTHRU_ARGV ('o' , "server-option" , & opt_fetch ,
990+ N_ ("server-specific" ),
991+ N_ ("option to transmit" ),
992+ 0 ),
993+ OPT_PASSTHRU ('4' , "ipv4" , & opt_ipv4 , NULL ,
994+ N_ ("use IPv4 addresses only" ),
995+ PARSE_OPT_NOARG ),
996+ OPT_PASSTHRU ('6' , "ipv6" , & opt_ipv6 , NULL ,
997+ N_ ("use IPv6 addresses only" ),
998+ PARSE_OPT_NOARG ),
999+ OPT_PASSTHRU_ARGV (0 , "negotiation-tip" , & opt_fetch , N_ ("revision" ),
1000+ N_ ("report that we have only objects reachable from this object" ),
1001+ 0 ),
1002+ OPT_BOOL (0 , "show-forced-updates" , & opt_show_forced_updates ,
1003+ N_ ("check for forced-updates on all updated branches" )),
1004+ OPT_PASSTHRU (0 , "set-upstream" , & set_upstream , NULL ,
1005+ N_ ("set upstream for git pull/fetch" ),
1006+ PARSE_OPT_NOARG ),
1007+
1008+ OPT_END ()
1009+ };
10111010
10121011 if (!getenv ("GIT_REFLOG_ACTION" ))
10131012 set_reflog_message (argc , argv );
0 commit comments