Re: [PATCH 1/5] t5312: test object deletion code paths in a corrupted repository
On Tue, Mar 17, 2015 at 3:28 AM, Jeff King <peff@peff.net> wrote:
Show 21 quoted lines
> When we are doing a destructive operation like "git prune",
> we want to be extra careful that the set of reachable tips
> we compute is valid. If there is any corruption or oddity,
> we are better off aborting the operation and letting the
> user figure things out rather than plowing ahead and
> possibly deleting some data that cannot be recovered.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> diff --git a/t/t5312-prune-corruption.sh b/t/t5312-prune-corruption.sh
> new file mode 100755
> index 0000000..167031e
> --- /dev/null
> +++ b/t/t5312-prune-corruption.sh
> @@ -0,0 +1,104 @@
> +# we do not want to count on running pack-refs to
> +# actually pack it, as it is perfectly reasonable to
> +# skip processing a broken ref
> +test_expect_success 'create packed-refs file with broken ref' '
> + rm -f .git/refs/heads/master &&
> + cat >.git/packed-refs <<-EOF
Show 7 quoted lines
> + $missing refs/heads/master
> + $recoverable refs/heads/other
> + EOF
> + echo $missing >expect &&
> + git rev-parse refs/heads/master >actual &&
> + test_cmp expect actual
> +'