Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
diff.c: fix "size cache" handling.
author
Junio C Hamano
<junkio@cox.net>
Thu, 3 May 2007 20:00:43 +0000
(13:00 -0700)
committer
Junio C Hamano
<junkio@cox.net>
Fri, 4 May 2007 05:12:40 +0000
(22:12 -0700)
We broke the size-cache handling when we changed the function
signature of sha1_object_info() in
21666f1a
. We obviously
wanted to cache the size we obtained when sha1_object_info()
succeeded, not when it failed.
Signed-off-by: Junio C Hamano <junkio@cox.net>
diff.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
9cf0430
)
diff --git
a/diff.c
b/diff.c
index d8f9242ea8fe2ee92884623939a85b6587a3ad9d..b28933f870d7dd11596fd3715280e1488ac2430f 100644
(file)
--- a/
diff.c
+++ b/
diff.c
@@
-1468,14
+1468,15
@@
int diff_populate_filespec(struct diff_filespec *s, int size_only)
enum object_type type;
struct sha1_size_cache *e;
enum object_type type;
struct sha1_size_cache *e;
+ if (size_only && use_size_cache &&
+ (e = locate_size_cache(s->sha1, 1, 0)) != NULL) {
+ s->size = e->size;
+ return 0;
+ }
+
if (size_only) {
if (size_only) {
- e = locate_size_cache(s->sha1, 1, 0);
- if (e) {
- s->size = e->size;
- return 0;
- }
type = sha1_object_info(s->sha1, &s->size);
type = sha1_object_info(s->sha1, &s->size);
- if (
type < 0
)
+ if (
use_size_cache && 0 < type
)
locate_size_cache(s->sha1, 0, s->size);
}
else {
locate_size_cache(s->sha1, 0, s->size);
}
else {