@@ -48,6 +48,7 @@ static int prune_tags = -1; /* unspecified */
48
48
49
49
static int all , append , dry_run , force , keep , multiple , update_head_ok , verbosity , deepen_relative ;
50
50
static int progress = -1 ;
51
+ static int enable_auto_gc = 1 ;
51
52
static int tags = TAGS_DEFAULT , unshallow , update_shallow , deepen ;
52
53
static int max_children = 1 ;
53
54
static enum transport_family family ;
@@ -169,6 +170,8 @@ static struct option builtin_fetch_options[] = {
169
170
OPT_STRING_LIST (0 , "negotiation-tip" , & negotiation_tip , N_ ("revision" ),
170
171
N_ ("report that we have only objects reachable from this object" )),
171
172
OPT_PARSE_LIST_OBJECTS_FILTER (& filter_options ),
173
+ OPT_BOOL (0 , "auto-gc" , & enable_auto_gc ,
174
+ N_ ("run 'gc --auto' after fetching" )),
172
175
OPT_END ()
173
176
};
174
177
@@ -1432,7 +1435,7 @@ static int fetch_multiple(struct string_list *list)
1432
1435
return errcode ;
1433
1436
}
1434
1437
1435
- argv_array_pushl (& argv , "fetch" , "--append" , NULL );
1438
+ argv_array_pushl (& argv , "fetch" , "--append" , "--no-auto-gc" , NULL );
1436
1439
add_options_to_argv (& argv );
1437
1440
1438
1441
for (i = 0 ; i < list -> nr ; i ++ ) {
@@ -1682,11 +1685,13 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
1682
1685
1683
1686
close_object_store (the_repository -> objects );
1684
1687
1685
- argv_array_pushl (& argv_gc_auto , "gc" , "--auto" , NULL );
1686
- if (verbosity < 0 )
1687
- argv_array_push (& argv_gc_auto , "--quiet" );
1688
- run_command_v_opt (argv_gc_auto .argv , RUN_GIT_CMD );
1689
- argv_array_clear (& argv_gc_auto );
1688
+ if (enable_auto_gc ) {
1689
+ argv_array_pushl (& argv_gc_auto , "gc" , "--auto" , NULL );
1690
+ if (verbosity < 0 )
1691
+ argv_array_push (& argv_gc_auto , "--quiet" );
1692
+ run_command_v_opt (argv_gc_auto .argv , RUN_GIT_CMD );
1693
+ argv_array_clear (& argv_gc_auto );
1694
+ }
1690
1695
1691
1696
return result ;
1692
1697
}
0 commit comments