projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add support for parallel HTTP transfers
[git.git]
/
read-cache.c
diff --git
a/read-cache.c
b/read-cache.c
index
0e345bd
..
c7f3b26
100644
(file)
--- a/
read-cache.c
+++ b/
read-cache.c
@@
-5,6
+5,7
@@
*/
#include "cache.h"
*/
#include "cache.h"
+int trust_executable_bit = 1;
struct cache_entry **active_cache = NULL;
unsigned int active_nr = 0, active_alloc = 0, active_cache_changed = 0;
struct cache_entry **active_cache = NULL;
unsigned int active_nr = 0, active_alloc = 0, active_cache_changed = 0;
@@
-464,11
+465,15
@@
int read_cache(void)
errno = EBUSY;
if (active_cache)
errno = EBUSY;
if (active_cache)
- return error("more than one cachefile");
+ return active_nr;
+
errno = ENOENT;
fd = open(get_index_file(), O_RDONLY);
errno = ENOENT;
fd = open(get_index_file(), O_RDONLY);
- if (fd < 0)
- return (errno == ENOENT) ? 0 : error("open failed");
+ if (fd < 0) {
+ if (errno == ENOENT)
+ return 0;
+ die("index file open failed (%s)", strerror(errno));
+ }
size = 0; // avoid gcc warning
map = MAP_FAILED;
size = 0; // avoid gcc warning
map = MAP_FAILED;
@@
-480,7
+485,7
@@
int read_cache(void)
}
close(fd);
if (map == MAP_FAILED)
}
close(fd);
if (map == MAP_FAILED)
-
return error("mmap failed"
);
+
die("index file mmap failed (%s)", strerror(errno)
);
hdr = map;
if (verify_hdr(hdr, size) < 0)
hdr = map;
if (verify_hdr(hdr, size) < 0)
@@
-501,7
+506,7
@@
int read_cache(void)
unmap:
munmap(map, size);
errno = EINVAL;
unmap:
munmap(map, size);
errno = EINVAL;
-
return error("verify header failed
");
+
die("index file corrupt
");
}
#define WRITE_BUFFER_SIZE 8192
}
#define WRITE_BUFFER_SIZE 8192