summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorKirill Smelkov <kirr@landau.phys.spbu.ru>2010-12-18 17:54:12 +0300
committerJunio C Hamano <gitster@pobox.com>2010-12-19 18:41:32 -0800
commit9ec09b0495f5e672223025f5e681371034da2538 (patch)
treefa3031a4d139c21da6e416e2280f47d97018bd11 /diff.c
parentb1b14ec3f14edfc5f76643aaaac6548fc94fb47e (diff)
downloadgit-9ec09b0495f5e672223025f5e681371034da2538.tar.gz
fill_textconv(): Don't get/put cache if sha1 is not valid
When blaming files in the working tree, the filespec is marked with !sha1_valid, as we have not given the contents an object name yet. The function to cache textconv results (keyed on the object name), however, didn't check this condition, and ended up on storing the cached result under a random object name. Cc: Axel Bonnet <axel.bonnet@ensimag.imag.fr> Cc: Clément Poulain <clement.poulain@ensimag.imag.fr> Cc: Diane Gasselin <diane.gasselin@ensimag.imag.fr> Cc: Jeff King <peff@peff.net> Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/diff.c b/diff.c
index 8256f313e4..fa3b29d92e 100644
--- a/diff.c
+++ b/diff.c
@@ -4388,7 +4388,7 @@ size_t fill_textconv(struct userdiff_driver *driver,
return df->size;
}
- if (driver->textconv_cache) {
+ if (driver->textconv_cache && df->sha1_valid) {
*outbuf = notes_cache_get(driver->textconv_cache, df->sha1,
&size);
if (*outbuf)
@@ -4399,7 +4399,7 @@ size_t fill_textconv(struct userdiff_driver *driver,
if (!*outbuf)
die("unable to read files to diff");
- if (driver->textconv_cache) {
+ if (driver->textconv_cache && df->sha1_valid) {
/* ignore errors, as we might be in a readonly repository */
notes_cache_put(driver->textconv_cache, df->sha1, *outbuf,
size);