Skip to content

Commit

Permalink
packed_git: convert pack_local flag into a bitfield and add pack_keep
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Brandon Casey authored and Junio C Hamano committed Nov 12, 2008
1 parent 9245ddd commit 8d25931
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
5 changes: 5 additions & 0 deletions sha1_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8d25931

Please sign in to comment.