summaryrefslogtreecommitdiff
path: root/checkout-cache.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-09 18:24:41 (GMT)
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-09 18:24:41 (GMT)
commit8d3af1d53255ac36494492720ebb83e932b0c0bc (patch)
tree09c369f30a7ec350dc98496c5cb752280f6dfe51 /checkout-cache.c
parentf7391ce3bd306c5731bc8206f8a0fa0947ca9474 (diff)
downloadgit-8d3af1d53255ac36494492720ebb83e932b0c0bc.zip
git-8d3af1d53255ac36494492720ebb83e932b0c0bc.tar.gz
git-8d3af1d53255ac36494492720ebb83e932b0c0bc.tar.bz2
Fix "checkout-cache.c" mis-use of read_sha1_file() interface.
It's supposed to test the returned file type, not think that read_sha1_file() tests it. Confusion from "cat-file" command line usage.
Diffstat (limited to 'checkout-cache.c')
-rw-r--r--checkout-cache.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/checkout-cache.c b/checkout-cache.c
index 1b50da8..6baf4f2 100644
--- a/checkout-cache.c
+++ b/checkout-cache.c
@@ -42,9 +42,10 @@ static int write_entry(struct cache_entry *ce)
void *new;
unsigned long size;
long wrote;
+ char type[20];
- new = read_sha1_file(ce->sha1, "blob", &size);
- if (!new) {
+ new = read_sha1_file(ce->sha1, type, &size);
+ if (!new || strcmp(type, "blob")) {
fprintf(stderr, "checkout-cache: unable to read sha1 file of %s (%s)\n",
ce->name, sha1_to_hex(ce->sha1));
return -1;