{
if (strncmp(base, entry->name, trim))
return 0;
+ /* Is this a "negative ref" that represents a deleted ref? */
+ if (is_null_sha1(entry->sha1))
+ return 0;
if (!(flags & DO_FOR_EACH_INCLUDE_BROKEN)) {
- if (is_null_sha1(entry->sha1))
- return 0;
if (!has_sha1_file(entry->sha1)) {
error("%s does not point to a valid object!", entry->name);
return 0;
if (fstat(fileno(logfp), &statbuf) ||
statbuf.st_size < ofs ||
fseek(logfp, -ofs, SEEK_END) ||
- fgets(buf, sizeof(buf), logfp))
+ fgets(buf, sizeof(buf), logfp)) {
+ fclose(logfp);
return -1;
+ }
}
while (fgets(buf, sizeof(buf), logfp)) {