@@ -22,16 +22,15 @@ enum {
2222 TAGS_SET = 2
2323};
2424
25- static int append , force , keep , update_head_ok , verbose , quiet ;
25+ static int append , force , keep , update_head_ok , verbosity ;
2626static int tags = TAGS_DEFAULT ;
2727static const char * depth ;
2828static const char * upload_pack ;
2929static struct strbuf default_rla = STRBUF_INIT ;
3030static struct transport * transport ;
3131
3232static struct option builtin_fetch_options [] = {
33- OPT__QUIET (& quiet ),
34- OPT__VERBOSE (& verbose ),
33+ OPT__VERBOSITY (& verbosity ),
3534 OPT_BOOLEAN ('a' , "append" , & append ,
3635 "append to .git/FETCH_HEAD instead of overwriting" ),
3736 OPT_STRING (0 , "upload-pack" , & upload_pack , "PATH" ,
@@ -192,7 +191,6 @@ static int s_update_ref(const char *action,
192191
193192static int update_local_ref (struct ref * ref ,
194193 const char * remote ,
195- int verbose ,
196194 char * display )
197195{
198196 struct commit * current = NULL , * updated ;
@@ -210,7 +208,7 @@ static int update_local_ref(struct ref *ref,
210208 die ("object %s not found" , sha1_to_hex (ref -> new_sha1 ));
211209
212210 if (!hashcmp (ref -> old_sha1 , ref -> new_sha1 )) {
213- if (verbose )
211+ if (verbosity > 0 )
214212 sprintf (display , "= %-*s %-*s -> %s" , SUMMARY_WIDTH ,
215213 "[up to date]" , REFCOL_WIDTH , remote ,
216214 pretty_ref );
@@ -366,18 +364,19 @@ static int store_updated_refs(const char *url, const char *remote_name,
366364 note );
367365
368366 if (ref )
369- rc |= update_local_ref (ref , what , verbose , note );
367+ rc |= update_local_ref (ref , what , note );
370368 else
371369 sprintf (note , "* %-*s %-*s -> FETCH_HEAD" ,
372370 SUMMARY_WIDTH , * kind ? kind : "branch" ,
373371 REFCOL_WIDTH , * what ? what : "HEAD" );
374372 if (* note ) {
375- if (!shown_url ) {
373+ if (verbosity >= 0 && !shown_url ) {
376374 fprintf (stderr , "From %.*s\n" ,
377375 url_len , url );
378376 shown_url = 1 ;
379377 }
380- fprintf (stderr , " %s\n" , note );
378+ if (verbosity >= 0 )
379+ fprintf (stderr , " %s\n" , note );
381380 }
382381 }
383382 fclose (fp );
@@ -637,9 +636,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
637636 remote = remote_get (argv [0 ]);
638637
639638 transport = transport_get (remote , remote -> url [0 ]);
640- if (verbose >= 2 )
639+ if (verbosity >= 2 )
641640 transport -> verbose = 1 ;
642- if (quiet )
641+ if (verbosity < 0 )
643642 transport -> verbose = -1 ;
644643 if (upload_pack )
645644 set_option (TRANS_OPT_UPLOADPACK , upload_pack );
0 commit comments