Skip to content

Commit dd57f52

Browse files
committed
prepare_revision_walk: complain of unused objects
todo: - write commit message - explain fast-export test issue (flushed out by switching to die; seems legit, but it does mean we double the warnings Signed-off-by: Jeff King <peff@peff.net>
1 parent 94f0577 commit dd57f52

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

revision.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,16 @@ void add_pending_oid(struct rev_info *revs, const char *name,
378378
add_pending_object(revs, object, name);
379379
}
380380

381+
static void warn_ignored_object(struct object *object, const char *name)
382+
{
383+
if (object->flags & UNINTERESTING)
384+
return;
385+
386+
warning(_("ignoring %s object in traversal: %s"),
387+
type_name(object->type),
388+
(name && *name) ? name : oid_to_hex(&object->oid));
389+
}
390+
381391
static struct commit *handle_commit(struct rev_info *revs,
382392
struct object_array_entry *entry)
383393
{
@@ -449,8 +459,10 @@ static struct commit *handle_commit(struct rev_info *revs,
449459
*/
450460
if (object->type == OBJ_TREE) {
451461
struct tree *tree = (struct tree *)object;
452-
if (!revs->tree_objects)
462+
if (!revs->tree_objects) {
463+
warn_ignored_object(object, name);
453464
return NULL;
465+
}
454466
if (flags & UNINTERESTING) {
455467
mark_tree_contents_uninteresting(revs->repo, tree);
456468
return NULL;
@@ -463,8 +475,10 @@ static struct commit *handle_commit(struct rev_info *revs,
463475
* Blob object? You know the drill by now..
464476
*/
465477
if (object->type == OBJ_BLOB) {
466-
if (!revs->blob_objects)
478+
if (!revs->blob_objects) {
479+
warn_ignored_object(object, name);
467480
return NULL;
481+
}
468482
if (flags & UNINTERESTING)
469483
return NULL;
470484
add_pending_object_with_path(revs, object, name, mode, path);

0 commit comments

Comments
 (0)