diff --git a/revision.c b/revision.c index 0c95edef59..693ee491b3 100644 --- a/revision.c +++ b/revision.c @@ -1904,8 +1904,13 @@ static int add_parents_only(struct rev_info *revs, const char *arg_, int flags, return 0; while (1) { it = get_reference(revs, arg, &oid, 0); - if (!it && revs->ignore_missing) - return 0; + if (!it) { + if (revs->ignore_missing) + return 0; + if (revs->do_not_die_on_missing_objects) + return 0; + return -1; + } if (it->type != OBJ_TAG) break; if (!((struct tag*)it)->tagged) diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh index dff442da20..cc070019be 100755 --- a/t/t0410-partial-clone.sh +++ b/t/t0410-partial-clone.sh @@ -489,6 +489,24 @@ test_expect_success 'rev-list dies for missing objects on cmd line' ' done ' +test_expect_success '--exclude-promisor-objects with ^@ on missing object' ' + rm -rf repo && + test_create_repo repo && + test_commit -C repo foo && + test_commit -C repo bar && + + COMMIT=$(git -C repo rev-parse foo) && + promise_and_delete "$COMMIT" && + + git -C repo config core.repositoryformatversion 1 && + git -C repo config extensions.partialclone "arbitrary string" && + + # Ensure that "$COMMIT^@" is handled gracefully even though the + # actual commits are missing. + git -C repo rev-list --exclude-promisor-objects "$COMMIT^@" >out && + test_must_be_empty out +' + test_expect_success 'single promisor remote can be re-initialized gracefully' ' # ensure one promisor is in the promisors list rm -rf repo &&