Skip to content

Commit 8d3af1d

Browse files
author
Linus Torvalds
committed
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.
1 parent f7391ce commit 8d3af1d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

checkout-cache.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ static int write_entry(struct cache_entry *ce)
4242
void *new;
4343
unsigned long size;
4444
long wrote;
45+
char type[20];
4546

46-
new = read_sha1_file(ce->sha1, "blob", &size);
47-
if (!new) {
47+
new = read_sha1_file(ce->sha1, type, &size);
48+
if (!new || strcmp(type, "blob")) {
4849
fprintf(stderr, "checkout-cache: unable to read sha1 file of %s (%s)\n",
4950
ce->name, sha1_to_hex(ce->sha1));
5051
return -1;

0 commit comments

Comments
 (0)