]> rtime.felk.cvut.cz Git - git.git/commitdiff
Merge branch 'jk/report-fail-to-read-objects-better' into maint
authorJunio C Hamano <gitster@pobox.com>
Wed, 25 Jun 2014 18:43:57 +0000 (11:43 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Jun 2014 18:43:58 +0000 (11:43 -0700)
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

1  2 
sha1_file.c

diff --cc sha1_file.c
index 3e9f55f1bb19a33908be174b2fa463f8142d4cae,1e1edf4b25d74633d3605b42c5a552c284922a6c..34d527f6708fe242f75b7fa0fa98e36a5c96a3be
@@@ -1436,16 -1422,19 +1436,17 @@@ static int stat_sha1_file(const unsigne
  static int open_sha1_file(const unsigned char *sha1)
  {
        int fd;
 -      char *name = sha1_file_name(sha1);
        struct alternate_object_database *alt;
+       int most_interesting_errno;
  
 -      fd = git_open_noatime(name);
 +      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) {
 -              name = alt->name;
 -              fill_sha1_path(name, sha1);
 +              fill_sha1_path(alt->name, sha1);
                fd = git_open_noatime(alt->base);
                if (fd >= 0)
                        return fd;