Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2021-03-05 18:21:50 +0300
committerJunio C Hamano <gitster@pobox.com>2021-03-05 22:33:52 +0300
commit13d746a303592068826824b30c47941fb328c8a7 (patch)
tree4c401453fa96d31cec741259c30835b5a58d94c5 /builtin/repack.c
parentdab324773422f38f8572185127a268813342805e (diff)
builtin/repack.c: assign pack split later
To determine the where to place the split when repacking with the '--geometric' option, split_pack_geometry() assigns the "split" variable and then decrements it in a loop. It would be equivalent (and more readable) to assign the split to the loop position after exiting the loop, so do that instead. Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/repack.c')
-rw-r--r--builtin/repack.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/builtin/repack.c b/builtin/repack.c
index 4ca2f647b4..21a5778e73 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -356,8 +356,6 @@ static void split_pack_geometry(struct pack_geometry *geometry, int factor)
return;
}
- split = geometry->pack_nr - 1;
-
/*
* First, count the number of packs (in descending order of size) which
* already form a geometric progression.
@@ -365,12 +363,12 @@ static void split_pack_geometry(struct pack_geometry *geometry, int factor)
for (i = geometry->pack_nr - 1; i > 0; i--) {
struct packed_git *ours = geometry->pack[i];
struct packed_git *prev = geometry->pack[i - 1];
- if (geometry_pack_weight(ours) >= factor * geometry_pack_weight(prev))
- split--;
- else
+ if (geometry_pack_weight(ours) < factor * geometry_pack_weight(prev))
break;
}
+ split = i;
+
if (split) {
/*
* Move the split one to the right, since the top element in the