summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0424138)
raw | patch | inline | side by side (parent: 0424138)
author | Junio C Hamano <junkio@cox.net> | |
Mon, 2 Apr 2007 04:34:34 +0000 (21:34 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 5 Apr 2007 22:07:16 +0000 (15:07 -0700) |
The function refresh_cache() is the only user of cache_errno
that switches its behaviour based on what internal function
refresh_cache_entry() finds; pass the error status back in a
parameter passed down to it, to get rid of the global variable
cache_errno.
Signed-off-by: Junio C Hamano <junkio@cox.net>
that switches its behaviour based on what internal function
refresh_cache_entry() finds; pass the error status back in a
parameter passed down to it, to get rid of the global variable
cache_errno.
Signed-off-by: Junio C Hamano <junkio@cox.net>
read-cache.c | patch | blob | history |
diff --git a/read-cache.c b/read-cache.c
index 8a7506d909421479eee30517ab3f3963c67cefd9..747b50a99a5009e64594fe4e8da11c827a8db336 100644 (file)
--- a/read-cache.c
+++ b/read-cache.c
struct cache_tree *active_cache_tree;
-static int cache_errno;
-
static void *cache_mmap;
static size_t cache_mmap_size;
* For example, you'd want to do this after doing a "git-read-tree",
* to link up the stat cache details with the proper files.
*/
-struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int really)
+static struct cache_entry *refresh_cache_ent(struct cache_entry *ce, int really, int *err)
{
struct stat st;
struct cache_entry *updated;
int changed, size;
if (lstat(ce->name, &st) < 0) {
- cache_errno = errno;
+ if (err)
+ *err = errno;
return NULL;
}
}
if (ce_modified(ce, &st, really)) {
- cache_errno = EINVAL;
+ if (err)
+ *err = EINVAL;
return NULL;
}
for (i = 0; i < active_nr; i++) {
struct cache_entry *ce, *new;
+ int cache_errno = 0;
+
ce = active_cache[i];
if (ce_stage(ce)) {
while ((i < active_nr) &&
continue;
}
- new = refresh_cache_entry(ce, really);
+ new = refresh_cache_ent(ce, really, &cache_errno);
if (new == ce)
continue;
if (!new) {
return has_errors;
}
+struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int really)
+{
+ return refresh_cache_ent(ce, really, NULL);
+}
+
static int verify_hdr(struct cache_header *hdr, unsigned long size)
{
SHA_CTX c;