If we've already looked at a packfile and determined it isn't
valid/usable as a pack, we shouldn't try to use it again in
the future either. This avoids multiple error messages from
the same packfile.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
cache.h | 1 +
sha1_file.c | 5 +++++
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/cache.h b/cache.h
index 9873ee9..64c2d3f 100644
--- a/cache.h
+++ b/cache.h
@@ -357,6 +357,7 @@ extern struct packed_git {
off_t pack_size;
int pack_fd;
int pack_local;
+ unsigned invalid: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 ba1c799..9f6e94e 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -714,6 +714,7 @@ struct packed_git *add_packed_git(char *path, int path_len, int local)
p->next = NULL;
p->windows = NULL;
p->pack_fd = -1;
+ p->invalid = 0;
p->pack_local = local;
if ((path_len > 44) && !get_sha1_hex(path + path_len - 44, sha1))
hashcpy(p->sha1, sha1);
@@ -746,6 +747,7 @@ struct packed_git *parse_pack_index_file(const unsigned char *sha1, char *idx_pa
p->next = NULL;
p->windows = NULL;
p->pack_fd = -1;
+ p->invalid = 0;
hashcpy(p->sha1, sha1);
return p;
}
@@ -1395,6 +1397,8 @@ static int find_pack_entry(const unsigned char *sha1, struct pack_entry *e, cons
prepare_packed_git();
for (p = packed_git; p; p = p->next) {
+ if (p->invalid)
+ continue;
if (ignore_packed) {
const char **ig;
for (ig = ignore_packed; *ig; ig++)
@@ -1418,6 +1422,7 @@ static int find_pack_entry(const unsigned char *sha1, struct pack_entry *e, cons
close(p->pack_fd);
p->pack_fd = -1;
}
+ p->invalid = 1;
error("packfile %s cannot be accessed", p->pack_name);
continue;
}
--
1.5.0.rc3.1.ge4b0e
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
| Greg Kroah-Hartman | [PATCH 019/196] DMA: Convert from class_device to device for DMA engine |
| Tejun Heo | [PATCH 4/7] FUSE: implement direct lseek support |
| Parag Warudkar | BUG: soft lockup - CPU#1 stuck for 15s! [swapper:0] |
| Greg Smith | PostgreSQL pgbench performance regression in 2.6.23+ |
git: | |
| Len Brown | fatal: unable to create '.git/index': File exists |
| Dan Farina | backup or mirror a repository |
| André Goddard Rosa | Using kdiff3 to compare two different revisions of a folder |
| Petko Manolov | git and binary files |
| Richard Stallman | Real men don't attack straw men |
| Steve B | Intel Atom and D945GCLF2 |
| Jeff Ross | U320 Drive on U160 controller? |
| Sunnz | How do I configure sendmail? |
| Eric Dumazet | [PATCH] fs: pipe/sockets/anon dentries should not have a parent |
| Denys Fedoryshchenko | thousands of classes, e1000 TX unit hang |
| Wei Yongjun | [PATCH] xfrm: Fix kernel panic when flush and dump SPD entries |
| Steffen Klassert | [RFC PATCH 4/5] crypto: allow allocation of percpu crypto transforms |
