From: Brandon Casey Date: Wed, 12 Nov 2008 17:59:03 +0000 (-0600) Subject: packed_git: convert pack_local flag into a bitfield and add pack_keep X-Git-Tag: v1.6.1-rc1~41^2~9 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8d25931d6ff47a7fb06512d767d1d416d9bc7733;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/cache.h b/cache.h index a1e4982cd..1a5740f58 100644 --- a/cache.h +++ b/cache.h @@ -671,7 +671,8 @@ extern struct packed_git { int index_version; time_t mtime; int pack_fd; - int pack_local; + unsigned pack_local:1, + pack_keep:1; unsigned char sha1[20]; /* something like ".git/objects/pack/xxxxx.pack" */ char pack_name[FLEX_ARRAY]; /* more */ diff --git a/sha1_file.c b/sha1_file.c index 12fc767ee..adb116350 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -828,6 +828,11 @@ struct packed_git *add_packed_git(const char *path, int path_len, int local) return NULL; } memcpy(p->pack_name, path, path_len); + + strcpy(p->pack_name + path_len, ".keep"); + if (!access(p->pack_name, F_OK)) + p->pack_keep = 1; + strcpy(p->pack_name + path_len, ".pack"); if (stat(p->pack_name, &st) || !S_ISREG(st.st_mode)) { free(p);