summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xt/t4102-apply-rename.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/t/t4102-apply-rename.sh b/t/t4102-apply-rename.sh
index 3aaae2f94c..3db3175ff9 100755
--- a/t/t4102-apply-rename.sh
+++ b/t/t4102-apply-rename.sh
@@ -58,4 +58,33 @@ test_expect_success 'apply copy' '
test "$(cat foo)" = "This is foo"
'
+test_expect_success 'apply rename and rewrite' '
+ cat >test-patch <<-\EOF &&
+ diff --git a/foo b/bar
+ similarity index 47%
+ rename from foo
+ rename to bar
+ --- a/foo
+ +++ b/bar
+ @@ -1 +1 @@
+ -This is foo
+ +This is bar
+ diff --git a/foo b/foo
+ dissimilarity index 82%
+ --- a/foo
+ +++ a/foo
+ @@ -1 +1 @@
+ -This is foo
+ +This is still foo
+ EOF
+
+ rm -f foo bar &&
+ echo "This is foo" >foo &&
+ git update-index --add --remove foo bar &&
+
+ git apply --index test-patch &&
+ test "$(cat bar)" = "This is bar" &&
+ test "$(cat foo)" = "This is still foo"
+'
+
test_done