summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-06-16 17:06:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-06-16 17:06:15 (GMT)
commit9d1d882e9c1d4a34e2ae3af47d50c1f115a6cf84 (patch)
tree7ad62be63d7139f16eef7d9b5bfaaa3865ad2d3b /sha1_file.c
parent414405969e4b3ae7d278c2eaf1995c21cbfb5fdc (diff)
parentd6c8a05bd58be82165be54f01c861c0fae28b8c4 (diff)
downloadgit-9d1d882e9c1d4a34e2ae3af47d50c1f115a6cf84.zip
git-9d1d882e9c1d4a34e2ae3af47d50c1f115a6cf84.tar.gz
git-9d1d882e9c1d4a34e2ae3af47d50c1f115a6cf84.tar.bz2
Merge branch 'jk/report-fail-to-read-objects-better'
* jk/report-fail-to-read-objects-better: open_sha1_file: report "most interesting" errno
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 3e9f55f..34d527f 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1437,19 +1437,23 @@ static int open_sha1_file(const unsigned char *sha1)
{
int fd;
struct alternate_object_database *alt;
+ int most_interesting_errno;
fd = git_open_noatime(sha1_file_name(sha1));
if (fd >= 0)
return fd;
+ most_interesting_errno = errno;
prepare_alt_odb();
- errno = ENOENT;
for (alt = alt_odb_list; alt; alt = alt->next) {
fill_sha1_path(alt->name, sha1);
fd = git_open_noatime(alt->base);
if (fd >= 0)
return fd;
+ if (most_interesting_errno == ENOENT)
+ most_interesting_errno = errno;
}
+ errno = most_interesting_errno;
return -1;
}