Skip to content

Commit

Permalink
git-gc --auto: simplify "repack" command line building
Browse files Browse the repository at this point in the history
Since "-a" is removed from the base repack command line,
we can simplify how we add additional options to this
command line when using --auto.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  • Loading branch information
Brandon Casey authored and Shawn O. Pearce committed Oct 16, 2007
1 parent edb0e04 commit 729f504
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions builtin-gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ static int too_many_packs(void)

static int need_to_gc(void)
{
int ac = 0;

/*
* Setting gc.auto and gc.autopacklimit to 0 or negative can
* disable the automatic gc.
Expand All @@ -158,14 +156,10 @@ static int need_to_gc(void)
* we run "repack -A -d -l". Otherwise we tell the caller
* there is no need.
*/
argv_repack[ac++] = "repack";
if (too_many_packs())
argv_repack[ac++] = "-A";
append_option(argv_repack, "-A", MAX_ADD);
else if (!too_many_loose_objects())
return 0;
argv_repack[ac++] = "-d";
argv_repack[ac++] = "-l";
argv_repack[ac++] = NULL;
return 1;
}

Expand Down

0 comments on commit 729f504

Please sign in to comment.