Subject: Re: [PATCH v2 2/6] midx-write: put failing response value back

From: Patrick Steinhardt <[email-masked]>
Date: Wed, 3 Sep 2025 12:15:08 +0200

On Sat, Aug 30, 2025 at 09:23:23PM +0000, Derrick Stolee via GitGitGadget wrote:
> diff --git a/midx-write.c b/midx-write.c
> index 070a7f61f4..0f1d5653ab 100644
> --- a/midx-write.c
> +++ b/midx-write.c
> @@ -1104,6 +1104,7 @@ static int write_midx_internal(struct repository *r, const char *object_dir,
>  			m = m->base_midx;
>  		}
>  	} else if (ctx.m && fill_packs_from_midx(&ctx)) {
> +		result = 1;
>  		goto cleanup;
>  	}

Would it make sense to also convert this command to return negative
error codes?

> diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh
> index 49705c62a2..008e65c22e 100755
> --- a/t/t5319-multi-pack-index.sh
> +++ b/t/t5319-multi-pack-index.sh
> @@ -1100,7 +1100,10 @@ test_expect_success 'load reverse index when missing .idx, .pack' '
>  		mv $idx.bak $idx &&
>  
>  		mv $pack $pack.bak &&
> -		git cat-file --batch-check="%(objectsize:disk)" <tip
> +		git cat-file --batch-check="%(objectsize:disk)" <tip &&
> +
> +		test_must_fail git multi-pack-index write 2>err &&
> +		grep "could not load pack" err

Nit: this should probably use `test_grep`.

Patrick