Skip to content

Commit 182c3d6

Browse files
committed
Merge branch 'jk/index-pack-report-missing' into maint
The error reporting from "git index-pack" has been improved to distinguish missing objects from type errors. * jk/index-pack-report-missing: index-pack: distinguish missing objects from type errors
2 parents a9041df + 77583e7 commit 182c3d6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

builtin/index-pack.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,13 @@ static unsigned check_object(struct object *obj)
207207
if (!(obj->flags & FLAG_CHECKED)) {
208208
unsigned long size;
209209
int type = sha1_object_info(obj->sha1, &size);
210-
if (type != obj->type || type <= 0)
211-
die(_("object of unexpected type"));
210+
if (type <= 0)
211+
die(_("did not receive expected object %s"),
212+
sha1_to_hex(obj->sha1));
213+
if (type != obj->type)
214+
die(_("object %s: expected type %s, found %s"),
215+
sha1_to_hex(obj->sha1),
216+
typename(obj->type), typename(type));
212217
obj->flags |= FLAG_CHECKED;
213218
return 1;
214219
}

0 commit comments

Comments
 (0)