Skip to content

Commit 44bdc43

Browse files
committed
Merge branch 'sv/objfixes' into maint
* sv/objfixes: Don't assume tree entries that are not dirs are blobs
2 parents 2cf69cf + e2ac7cb commit 44bdc43

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

object.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,11 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
160160
parse_tag_buffer(tag, buffer, size);
161161
obj = &tag->object;
162162
} else {
163+
warning("object %s has unknown type id %d\n", sha1_to_hex(sha1), type);
163164
obj = NULL;
164165
}
166+
if (obj && obj->type == OBJ_NONE)
167+
obj->type = type;
165168
*eaten_p = eaten;
166169
return obj;
167170
}

tree.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,13 @@ static void track_tree_refs(struct tree *item)
173173
continue;
174174
if (S_ISDIR(entry.mode))
175175
obj = &lookup_tree(entry.sha1)->object;
176-
else
176+
else if (S_ISREG(entry.mode) || S_ISLNK(entry.mode))
177177
obj = &lookup_blob(entry.sha1)->object;
178+
else {
179+
warning("in tree %s: entry %s has bad mode %.6o\n",
180+
sha1_to_hex(item->object.sha1), entry.path, entry.mode);
181+
obj = lookup_unknown_object(entry.sha1);
182+
}
178183
refs->ref[i++] = obj;
179184
}
180185
set_object_refs(&item->object, refs);

0 commit comments

Comments
 (0)