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
This commit is contained in:
commit
81bd9b1000
@ -1437,19 +1437,23 @@ static int open_sha1_file(const unsigned char *sha1)
|
|||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
struct alternate_object_database *alt;
|
struct alternate_object_database *alt;
|
||||||
|
int most_interesting_errno;
|
||||||
|
|
||||||
fd = git_open_noatime(sha1_file_name(sha1));
|
fd = git_open_noatime(sha1_file_name(sha1));
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
return fd;
|
return fd;
|
||||||
|
most_interesting_errno = errno;
|
||||||
|
|
||||||
prepare_alt_odb();
|
prepare_alt_odb();
|
||||||
errno = ENOENT;
|
|
||||||
for (alt = alt_odb_list; alt; alt = alt->next) {
|
for (alt = alt_odb_list; alt; alt = alt->next) {
|
||||||
fill_sha1_path(alt->name, sha1);
|
fill_sha1_path(alt->name, sha1);
|
||||||
fd = git_open_noatime(alt->base);
|
fd = git_open_noatime(alt->base);
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
return fd;
|
return fd;
|
||||||
|
if (most_interesting_errno == ENOENT)
|
||||||
|
most_interesting_errno = errno;
|
||||||
}
|
}
|
||||||
|
errno = most_interesting_errno;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user