diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-06-25 11:43:57 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-06-25 11:43:58 -0700 |
commit | 81bd9b100064094bf6db05d85853284e9b15376a (patch) | |
tree | f0ab7563fa4e093c7cb17bfa952f6d3f1bfd708b | |
parent | Merge branch 'mn/sideband-no-ansi' into maint (diff) | |
parent | open_sha1_file: report "most interesting" errno (diff) | |
download | tgif-81bd9b100064094bf6db05d85853284e9b15376a.tar.xz |
Merge branch 'jk/report-fail-to-read-objects-better' into maint
Reworded the error message given upon a failure to open an existing
loose object file due to e.g. permission issues; it was reported as
the object being corrupt, but that is not quite true.
* jk/report-fail-to-read-objects-better:
open_sha1_file: report "most interesting" errno
-rw-r--r-- | sha1_file.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sha1_file.c b/sha1_file.c index 3e9f55f1bb..34d527f670 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; } |