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 <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Casey committed
Nov 12, 2008 at 11:59 UTC
8d25931d6ff47a7fb06512d767d1d416d9bc7733
2 files changed
+7
-1
cache.h
+2
-1
@@ -671,7 +671,8 @@ extern struct packed_git {
671
int index_version;
672
time_t mtime;
673
int pack_fd;
674
- int pack_local;
674
+ unsigned pack_local:1,
675
+ pack_keep:1;
676
unsigned char sha1[20];
677
/* something like ".git/objects/pack/xxxxx.pack" */
678
char pack_name[FLEX_ARRAY]; /* more */
sha1_file.c
+5
@@ -828,6 +828,11 @@ struct packed_git *add_packed_git(const char *path, int path_len, int local)
828
return NULL;
829
}
830
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
+
836
strcpy(p->pack_name + path_len, ".pack");
837
if (stat(p->pack_name, &st) || !S_ISREG(st.st_mode)) {
838
free(p);