Merge branch 'ps/pack-refs-auto-heuristics'

"git pack-refs --auto" for the files backend was too aggressive,
which has been a bit tamed.

* ps/pack-refs-auto-heuristics:
  refs/files: use heuristic to decide whether to repack with `--auto`
  t0601: merge tests for auto-packing of refs
  wrapper: introduce `log2u()`
This commit is contained in:
Junio C Hamano
2024-09-12 11:47:23 -07:00
6 changed files with 194 additions and 27 deletions

View File

@ -1130,16 +1130,6 @@ cleanup:
return res;
}
static inline int log2i(int n)
{
int log2 = 0;
for (; n > 1; n >>= 1)
log2++;
return log2;
}
static inline int exp2i(int n)
{
return 1 << n;
@ -1162,7 +1152,7 @@ int estimate_bisect_steps(int all)
if (all < 3)
return 0;
n = log2i(all);
n = log2u(all);
e = exp2i(n);
x = all - e;