Skip to content

Commit

Permalink
Merge branch 'jk/report-fail-to-read-objects-better'
Browse files Browse the repository at this point in the history
* jk/report-fail-to-read-objects-better:
  open_sha1_file: report "most interesting" errno
  • Loading branch information
Junio C Hamano committed Jun 16, 2014
2 parents 4144059 + d6c8a05 commit 9d1d882
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sha1_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 9d1d882

Please sign in to comment.