summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-10-22 16:38:08 -0700
committerJunio C Hamano <gitster@pobox.com>2014-10-23 12:29:28 -0700
commite275a78e29a4d3d245f079a09fcec64459462d74 (patch)
treea5f24ace239573b35eac674f178a3f025d44997e
parent0d6dd4df8af63d4655c5f739ce77086df2e120c1 (diff)
downloadgit-jc/apply-atomic.tar.gz
t4102: test renaming and rewriting the same filejc/apply-atomic
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-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