Skip to content

Commit 8d25931

Browse files
drafnelgitster
authored andcommitted
packed_git: convert pack_local flag into a bitfield and add pack_keep
pack_keep will be set when a pack file has an associated .keep file. Signed-off-by: Brandon Casey <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9245ddd commit 8d25931

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

cache.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,8 @@ extern struct packed_git {
671671
int index_version;
672672
time_t mtime;
673673
int pack_fd;
674-
int pack_local;
674+
unsigned pack_local:1,
675+
pack_keep:1;
675676
unsigned char sha1[20];
676677
/* something like ".git/objects/pack/xxxxx.pack" */
677678
char pack_name[FLEX_ARRAY]; /* more */

sha1_file.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,11 @@ struct packed_git *add_packed_git(const char *path, int path_len, int local)
828828
return NULL;
829829
}
830830
memcpy(p->pack_name, path, path_len);
831+
832+
strcpy(p->pack_name + path_len, ".keep");
833+
if (!access(p->pack_name, F_OK))
834+
p->pack_keep = 1;
835+
831836
strcpy(p->pack_name + path_len, ".pack");
832837
if (stat(p->pack_name, &st) || !S_ISREG(st.st_mode)) {
833838
free(p);

0 commit comments

Comments
 (0)