diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c index 6e73c85cde..753bd53a70 100644 --- a/builtin/multi-pack-index.c +++ b/builtin/multi-pack-index.c @@ -90,7 +90,8 @@ static struct odb_source_files *handle_object_dir_option(struct repository *repo { struct odb_source *source = odb_find_source(repo->objects, opts.object_dir); if (!source) - source = odb_add_to_alternates_memory(repo->objects, opts.object_dir); + die(_("object directory is not an alternate of the current repository: '%s'"), + opts.object_dir); return odb_source_files_downcast(source); } diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh index 68143cb5b7..00e90f163f 100755 --- a/t/t5319-multi-pack-index.sh +++ b/t/t5319-multi-pack-index.sh @@ -698,10 +698,9 @@ test_expect_success 'force some 64-bit offsets with pack-objects' ' corrupt_data $idx64 $(test_oid idxoff) "\02" && # objects64 is not a real repository, but can serve as an alternate # anyway so we can write a MIDX into it - git init repo && - test_when_finished "rm -fr repo" && + git init repo64 && ( - cd repo && + cd repo64 && ( cd ../objects64 && pwd ) >.git/objects/info/alternates && midx64=$(git multi-pack-index --object-dir=../objects64 write) ) && @@ -709,7 +708,7 @@ test_expect_success 'force some 64-bit offsets with pack-objects' ' ' test_expect_success 'verify multi-pack-index with 64-bit offsets' ' - git multi-pack-index verify --object-dir=objects64 + git -C repo64 multi-pack-index verify --object-dir=../objects64 ' NUM_OBJECTS=63 @@ -721,7 +720,7 @@ MIDX_BYTE_LARGE_OFFSET=$(($MIDX_OFFSET_LARGE_OFFSETS + 3)) test_expect_success 'verify incorrect 64-bit offset' ' corrupt_midx_and_verify $MIDX_BYTE_LARGE_OFFSET "\07" objects64 \ - "incorrect object offset" + "incorrect object offset" "git -C repo64 multi-pack-index verify --object-dir=../objects64" ' test_expect_success 'setup expire tests' '