From 4cf76f6bbf8b4d7d32c7c6aec0576959c6accb63 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Mon, 16 Mar 2020 18:05:07 +0000 Subject: builtin/reset: compute checkout metadata for reset Pass the commit, and if we have it, the ref to the filters when we perform a checkout. This should only be the case when we invoke git reset --hard; the metadata will be unused otherwise. Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- t/t0021-conversion.sh | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh index 3efb0dad20..a026fd46b4 100755 --- a/t/t0021-conversion.sh +++ b/t/t0021-conversion.sh @@ -447,7 +447,8 @@ test_expect_success PERL 'required process filter should filter data for various git commit -m "test commit 3" && git checkout empty-branch && filter_git rebase --onto empty-branch master^^ master && - META="ref=refs/heads/master treeish=$(git rev-parse --verify master)" && + MASTER2=$(git rev-parse --verify master) && + META="ref=refs/heads/master treeish=$MASTER2" && cat >expected.log <<-EOF && START init handshake complete @@ -458,6 +459,35 @@ test_expect_success PERL 'required process filter should filter data for various IN: smudge testsubdir/test3 '\''sq'\'',\$x=.r $META blob=$M3 $S3 [OK] -- OUT: $S3 . [OK] STOP EOF + test_cmp_exclude_clean expected.log debug.log && + + git reset --hard empty-branch && + filter_git reset --hard $MASTER && + META="treeish=$MASTER" && + cat >expected.log <<-EOF && + START + init handshake complete + IN: smudge test.r $META blob=$M $S [OK] -- OUT: $S . [OK] + IN: smudge test2.r $META blob=$M2 $S2 [OK] -- OUT: $S2 . [OK] + IN: smudge test4-empty.r $META blob=$EMPTY 0 [OK] -- OUT: 0 [OK] + IN: smudge testsubdir/test3 '\''sq'\'',\$x=.r $META blob=$M3 $S3 [OK] -- OUT: $S3 . [OK] + STOP + EOF + test_cmp_exclude_clean expected.log debug.log && + + git branch old-master $MASTER && + git reset --hard empty-branch && + filter_git reset --hard old-master && + META="ref=refs/heads/old-master treeish=$MASTER" && + cat >expected.log <<-EOF && + START + init handshake complete + IN: smudge test.r $META blob=$M $S [OK] -- OUT: $S . [OK] + IN: smudge test2.r $META blob=$M2 $S2 [OK] -- OUT: $S2 . [OK] + IN: smudge test4-empty.r $META blob=$EMPTY 0 [OK] -- OUT: 0 [OK] + IN: smudge testsubdir/test3 '\''sq'\'',\$x=.r $META blob=$M3 $S3 [OK] -- OUT: $S3 . [OK] + STOP + EOF test_cmp_exclude_clean expected.log debug.log ) ' -- cgit v1.2.3