@@ -27,6 +27,7 @@ static const char * const worktree_usage[] = {
27
27
struct add_opts {
28
28
int force ;
29
29
int detach ;
30
+ int quiet ;
30
31
int checkout ;
31
32
int keep_locked ;
32
33
};
@@ -303,9 +304,13 @@ static int add_worktree(const char *path, const char *refname,
303
304
if (!is_branch )
304
305
argv_array_pushl (& cp .args , "update-ref" , "HEAD" ,
305
306
oid_to_hex (& commit -> object .oid ), NULL );
306
- else
307
+ else {
307
308
argv_array_pushl (& cp .args , "symbolic-ref" , "HEAD" ,
308
309
symref .buf , NULL );
310
+ if (opts -> quiet )
311
+ argv_array_push (& cp .args , "--quiet" );
312
+ }
313
+
309
314
cp .env = child_env .argv ;
310
315
ret = run_command (& cp );
311
316
if (ret )
@@ -315,6 +320,8 @@ static int add_worktree(const char *path, const char *refname,
315
320
cp .argv = NULL ;
316
321
argv_array_clear (& cp .args );
317
322
argv_array_pushl (& cp .args , "reset" , "--hard" , NULL );
323
+ if (opts -> quiet )
324
+ argv_array_push (& cp .args , "--quiet" );
318
325
cp .env = child_env .argv ;
319
326
ret = run_command (& cp );
320
327
if (ret )
@@ -437,6 +444,7 @@ static int add(int ac, const char **av, const char *prefix)
437
444
OPT_BOOL (0 , "detach" , & opts .detach , N_ ("detach HEAD at named commit" )),
438
445
OPT_BOOL (0 , "checkout" , & opts .checkout , N_ ("populate the new working tree" )),
439
446
OPT_BOOL (0 , "lock" , & opts .keep_locked , N_ ("keep the new working tree locked" )),
447
+ OPT__QUIET (& opts .quiet , N_ ("suppress progress reporting" )),
440
448
OPT_PASSTHRU (0 , "track" , & opt_track , NULL ,
441
449
N_ ("set up tracking mode (see git-branch(1))" ),
442
450
PARSE_OPT_NOARG | PARSE_OPT_OPTARG ),
@@ -491,15 +499,17 @@ static int add(int ac, const char **av, const char *prefix)
491
499
}
492
500
}
493
501
}
494
-
495
- print_preparing_worktree_line (opts .detach , branch , new_branch , !!new_branch_force );
502
+ if (! opts . quiet )
503
+ print_preparing_worktree_line (opts .detach , branch , new_branch , !!new_branch_force );
496
504
497
505
if (new_branch ) {
498
506
struct child_process cp = CHILD_PROCESS_INIT ;
499
507
cp .git_cmd = 1 ;
500
508
argv_array_push (& cp .args , "branch" );
501
509
if (new_branch_force )
502
510
argv_array_push (& cp .args , "--force" );
511
+ if (opts .quiet )
512
+ argv_array_push (& cp .args , "--quiet" );
503
513
argv_array_push (& cp .args , new_branch );
504
514
argv_array_push (& cp .args , branch );
505
515
if (opt_track )
0 commit comments