summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cfd88e2)
raw | patch | inline | side by side (parent: cfd88e2)
author | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Mon, 11 Apr 2005 18:33:58 +0000 (11:33 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Mon, 11 Apr 2005 18:33:58 +0000 (11:33 -0700) |
The size field isn't in the tree information, so we need to
update it if the sha1 matches.
update it if the sha1 matches.
update-cache.c | patch | blob | history |
diff --git a/update-cache.c b/update-cache.c
index 68a0ae0444d700593198c748a00c9f2b0841bda8..b39185a1fecb18626fb3c3cc8bd5054096f3edfe 100644 (file)
--- a/update-cache.c
+++ b/update-cache.c
return 0;
}
-static int compare_data(struct cache_entry *ce)
+static int compare_data(struct cache_entry *ce, unsigned long expected_size)
{
int match = -1;
int fd = open(ce->name, O_RDONLY);
buffer = read_sha1_file(ce->sha1, type, &size);
if (buffer) {
- if (size == ce->st_size && !strcmp(type, "blob"))
+ if (size == expected_size && !strcmp(type, "blob"))
match = match_data(fd, buffer, size);
free(buffer);
}
return ce;
/*
- * If the length has changed, there's no point in trying
+ * If the mode has changed, there's no point in trying
* to refresh the entry - it's not going to match
*/
- if (changed & (DATA_CHANGED | MODE_CHANGED))
+ if (changed & MODE_CHANGED)
return NULL;
- if (compare_data(ce))
+ if (compare_data(ce, st.st_size))
return NULL;
size = ce_size(ce);
updated = malloc(size);
memcpy(updated, ce, size);
fill_stat_cache_info(updated, &st);
+ updated->st_size = st.st_size;
return updated;
}