t0021: test filter metadata for additional cases

Check that we get the expected data when performing a merges or
generating archives.  Note that we don't expect a ref for merges,
because we won't be checking out any particular ref, but instead a tree
of the merged data.  For archives, however, we expect a ref as normal if
we have one.

Signed-off-by: brian m. carlson <bk2204@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
brian m. carlson 2020-03-16 18:05:08 +00:00 committed by Junio C Hamano
parent 4cf76f6bbf
commit 0c0f8a7f28

View File

@ -488,6 +488,51 @@ 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 checkout -b merge empty-branch &&
git branch -f master $MASTER2 &&
filter_git merge master &&
META="treeish=$MASTER2" &&
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 test5.r $META blob=$M $S [OK] -- OUT: $S . [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 &&
filter_git archive master >/dev/null &&
META="ref=refs/heads/master treeish=$MASTER2" &&
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 test5.r $META blob=$M $S [OK] -- OUT: $S . [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 &&
TREE="$(git rev-parse $MASTER2^{tree})" &&
filter_git archive $TREE >/dev/null &&
META="treeish=$TREE" &&
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 test5.r $META blob=$M $S [OK] -- OUT: $S . [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
)
'