summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6991357)
raw | patch | inline | side by side (parent: 6991357)
author | Johannes Sixt <johannes.sixt@telecom.at> | |
Fri, 4 Jul 2008 06:43:19 +0000 (08:43 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 4 Jul 2008 08:36:25 +0000 (01:36 -0700) |
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t4127-apply-same-fn.sh | patch | blob | history |
index 2a6ed77c658423c01c1713eab194ccb86b25c476..1f859dd908cb298bf89a13822e8fc19882060689 100755 (executable)
--- a/t/t4127-apply-same-fn.sh
+++ b/t/t4127-apply-same-fn.sh
. ./test-lib.sh
+modify () {
+ sed -e "$1" < "$2" > "$2".x &&
+ mv "$2".x "$2"
+}
+
test_expect_success setup '
for i in a b c d e f g h i j k l m
do
git commit -m initial
'
test_expect_success 'apply same filename with independent changes' '
- sed -i -e "s/^d/z/" same_fn &&
+ modify "s/^d/z/" same_fn &&
git diff > patch0 &&
git add same_fn &&
- sed -i -e "s/^i/y/" same_fn &&
+ modify "s/^i/y/" same_fn &&
git diff >> patch0 &&
cp same_fn same_fn2 &&
git reset --hard &&
test_expect_success 'apply same filename with overlapping changes' '
git reset --hard
- sed -i -e "s/^d/z/" same_fn &&
+ modify "s/^d/z/" same_fn &&
git diff > patch0 &&
git add same_fn &&
- sed -i -e "s/^e/y/" same_fn &&
+ modify "s/^e/y/" same_fn &&
git diff >> patch0 &&
cp same_fn same_fn2 &&
git reset --hard &&
test_expect_success 'apply same new filename after rename' '
git reset --hard
git mv same_fn new_fn
- sed -i -e "s/^d/z/" new_fn &&
+ modify "s/^d/z/" new_fn &&
git add new_fn &&
git diff -M --cached > patch1 &&
- sed -i -e "s/^e/y/" new_fn &&
+ modify "s/^e/y/" new_fn &&
git diff >> patch1 &&
cp new_fn new_fn2 &&
git reset --hard &&
test_expect_success 'apply same old filename after rename -- should fail.' '
git reset --hard
git mv same_fn new_fn
- sed -i -e "s/^d/z/" new_fn &&
+ modify "s/^d/z/" new_fn &&
git add new_fn &&
git diff -M --cached > patch1 &&
git mv new_fn same_fn
- sed -i -e "s/^e/y/" same_fn &&
+ modify "s/^e/y/" same_fn &&
git diff >> patch1 &&
git reset --hard &&
test_must_fail git apply patch1
test_expect_success 'apply A->B (rename), C->A (rename), A->A -- should pass.' '
git reset --hard
git mv same_fn new_fn
- sed -i -e "s/^d/z/" new_fn &&
+ modify "s/^d/z/" new_fn &&
git add new_fn &&
git diff -M --cached > patch1 &&
git commit -m "a rename" &&
git mv other_fn same_fn
- sed -i -e "s/^e/y/" same_fn &&
+ modify "s/^e/y/" same_fn &&
git add same_fn &&
git diff -M --cached >> patch1 &&
- sed -i -e "s/^g/x/" same_fn &&
+ modify "s/^g/x/" same_fn &&
git diff >> patch1 &&
git reset --hard HEAD^ &&
git apply patch1