#!/bin/sh # Test for GitHub Issue #22: File moves are ignored by filterdiff # This test case reproduces the exact scenario from the issue . ${top_srcdir-.}/tests/common.sh cat << EOF > git-rename.patch diff --git a/tests/wpt/web-platform-tests/2dcontext/transformations/2d.transformation.order.html b/tests/wpt/web-platform-tests/2dcontext/transformations/2d.transformation.order-new.html similarity index 100% rename from tests/wpt/web-platform-tests/2dcontext/transformations/2d.transformation.order.html rename to tests/wpt/web-platform-tests/2dcontext/transformations/2d.transformation.order-new.html EOF # Test that filterdiff includes the rename when it matches the filter ${FILTERDIFF} --git-extended-diffs=include --git-prefixes=strip -i "*wpt*" git-rename.patch 2>errors >result || exit 1 [ -s errors ] && exit 1 # The result should contain the complete git diff block cat << EOF | cmp - result || exit 1 diff --git a/tests/wpt/web-platform-tests/2dcontext/transformations/2d.transformation.order.html b/tests/wpt/web-platform-tests/2dcontext/transformations/2d.transformation.order-new.html similarity index 100% rename from tests/wpt/web-platform-tests/2dcontext/transformations/2d.transformation.order.html rename to tests/wpt/web-platform-tests/2dcontext/transformations/2d.transformation.order-new.html EOF # Test that filterdiff excludes the rename when it doesn't match the filter ${FILTERDIFF} --git-extended-diffs=include --git-prefixes=strip -i something-else git-rename.patch 2>errors2 >result2 || exit 1 [ -s errors2 ] && exit 1 # The result should be empty [ -s result2 ] && exit 1 # Test lsdiff works with renames ${LSDIFF} --git-extended-diffs=include --git-extended-diffs=include --git-prefixes=strip git-rename.patch 2>errors3 >result3 || exit 1 [ -s errors3 ] && exit 1 cat << EOF | cmp - result3 || exit 1 tests/wpt/web-platform-tests/2dcontext/transformations/2d.transformation.order.html EOF exit 0