Skip to content

Commit

Permalink
Fix "checkout-cache.c" mis-use of read_sha1_file() interface.
Browse files Browse the repository at this point in the history
It's supposed to test the returned file type, not think that read_sha1_file()
tests it. Confusion from "cat-file" command line usage.
  • Loading branch information
Linus Torvalds committed Apr 9, 2005
1 parent f7391ce commit 8d3af1d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions checkout-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8d3af1d

Please sign in to comment.