Skip to content

Commit 01af249

Browse files
drafnelgitster
authored andcommitted
builtin-gc.c: use new pack_keep bitfield to detect .keep file existence
Signed-off-by: Brandon Casey <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f7991d1 commit 01af249

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

builtin-gc.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,9 @@ static int too_many_packs(void)
134134

135135
prepare_packed_git();
136136
for (cnt = 0, p = packed_git; p; p = p->next) {
137-
char path[PATH_MAX];
138-
size_t len;
139-
int keep;
140-
141137
if (!p->pack_local)
142138
continue;
143-
len = strlen(p->pack_name);
144-
if (PATH_MAX <= len + 1)
145-
continue; /* oops, give up */
146-
memcpy(path, p->pack_name, len-5);
147-
memcpy(path + len - 5, ".keep", 6);
148-
keep = access(p->pack_name, F_OK) && (errno == ENOENT);
149-
if (keep)
139+
if (p->pack_keep)
150140
continue;
151141
/*
152142
* Perhaps check the size of the pack and count only

0 commit comments

Comments
 (0)