Skip to content

Commit e5ce383

Browse files
committed
Merge branch 'jk/warn-ignored-object' into HEAD
* jk/warn-ignored-object: fast-export: leave warnings to revision code prepare_revision_walk: complain of unused objects
2 parents 6ebed3e + c931a50 commit e5ce383

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

builtin/fast-export.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,9 +1092,6 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)
10921092

10931093
commit = get_commit(e, full_name);
10941094
if (!commit) {
1095-
warning(_("%s: unexpected object of type %s, skipping."),
1096-
e->name,
1097-
type_name(e->item->type));
10981095
free(full_name);
10991096
continue;
11001097
}

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)