mirror of
https://github.com/git/git
synced 2024-08-28 12:09:19 +00:00
builtin-gc.c: use new pack_keep bitfield to detect .keep file existence
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
f7991d1ed3
commit
01af249fa1
12
builtin-gc.c
12
builtin-gc.c
|
@ -134,19 +134,9 @@ static int too_many_packs(void)
|
||||||
|
|
||||||
prepare_packed_git();
|
prepare_packed_git();
|
||||||
for (cnt = 0, p = packed_git; p; p = p->next) {
|
for (cnt = 0, p = packed_git; p; p = p->next) {
|
||||||
char path[PATH_MAX];
|
|
||||||
size_t len;
|
|
||||||
int keep;
|
|
||||||
|
|
||||||
if (!p->pack_local)
|
if (!p->pack_local)
|
||||||
continue;
|
continue;
|
||||||
len = strlen(p->pack_name);
|
if (p->pack_keep)
|
||||||
if (PATH_MAX <= len + 1)
|
|
||||||
continue; /* oops, give up */
|
|
||||||
memcpy(path, p->pack_name, len-5);
|
|
||||||
memcpy(path + len - 5, ".keep", 6);
|
|
||||||
keep = access(p->pack_name, F_OK) && (errno == ENOENT);
|
|
||||||
if (keep)
|
|
||||||
continue;
|
continue;
|
||||||
/*
|
/*
|
||||||
* Perhaps check the size of the pack and count only
|
* Perhaps check the size of the pack and count only
|
||||||
|
|
Loading…
Reference in a new issue