summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-03-31 00:47:38 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-03-31 04:47:39 (GMT)
commit319b678a7b7c7fd03242b2b91d936f65e798cd06 (patch)
tree2b65f3bdaeb38c1c945a95f6898d44ee8e1854c1 /sha1_file.c
parente156455ea49124c140a67623f22a393db62d5d98 (diff)
downloadgit-319b678a7b7c7fd03242b2b91d936f65e798cd06.zip
git-319b678a7b7c7fd03242b2b91d936f65e798cd06.tar.gz
git-319b678a7b7c7fd03242b2b91d936f65e798cd06.tar.bz2
sha1_file: squelch "packfile cannot be accessed" warnings
When we find an object in a packfile index, we make sure we can still open the packfile itself (or that it is already open), as it might have been deleted by a simultaneous repack. If we can't access the packfile, we print a warning for the user and tell the caller that we don't have the object (we can then look in other packfiles, or find a loose version, before giving up). The warning we print to the user isn't really accomplishing anything, and it is potentially confusing to users. In the normal case, it is complete noise; we find the object elsewhere, and the user does not have to care that we racily saw a packfile index that became stale. It didn't affect the operation at all. A possibly more interesting case is when we later can't find the object, and report failure to the user. In this case the warning could be considered a clue toward that ultimate failure. But it's not really a useful clue in practice. We wouldn't even print it consistently (since we are racing with another process, we might not even see the .idx file, or we might win the race and open the packfile, completing the operation). This patch drops the warning entirely (not only from the fill_pack_entry site, but also from an identical use in pack-objects). If we did find the warning interesting in the error case, we could stuff it away and reveal it to the user when we later die() due to the broken object. But that complexity just isn't worth it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 3e9f55f..fef54a8 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2441,10 +2441,8 @@ static int fill_pack_entry(const unsigned char *sha1,
* answer, as it may have been deleted since the index was
* loaded!
*/
- if (!is_pack_valid(p)) {
- warning("packfile %s cannot be accessed", p->pack_name);
+ if (!is_pack_valid(p))
return 0;
- }
e->offset = offset;
e->p = p;
hashcpy(e->sha1, sha1);