summaryrefslogtreecommitdiff
path: root/t/t4116-apply-reverse.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-08-16 23:09:25 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-08-17 04:08:45 (GMT)
commit2cda1a214e9d2e362242027b4b622ecb3d9260de (patch)
treedbb12a6dc86bd5070772425c9b82cda32a87d8e9 /t/t4116-apply-reverse.sh
parentd4c452f03b49072ebb46fc524e6d85056a35ef13 (diff)
downloadgit-2cda1a214e9d2e362242027b4b622ecb3d9260de.zip
git-2cda1a214e9d2e362242027b4b622ecb3d9260de.tar.gz
git-2cda1a214e9d2e362242027b4b622ecb3d9260de.tar.bz2
apply --reverse: tie it all together.
Add a few tests, usage string, and documentation. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 't/t4116-apply-reverse.sh')
-rwxr-xr-xt/t4116-apply-reverse.sh47
1 files changed, 43 insertions, 4 deletions
diff --git a/t/t4116-apply-reverse.sh b/t/t4116-apply-reverse.sh
index 69aebe6..74f5c2a 100755
--- a/t/t4116-apply-reverse.sh
+++ b/t/t4116-apply-reverse.sh
@@ -22,25 +22,64 @@ test_expect_success setup '
tr "[mon]" '\''[\0\1\2]'\'' <file1 >file2 &&
git commit -a -m second &&
+ git tag second &&
- git diff --binary -R initial >patch
+ git diff --binary initial second >patch
'
test_expect_success 'apply in forward' '
+ T0=`git rev-parse "second^{tree}"` &&
+ git reset --hard initial &&
git apply --index --binary patch &&
- git diff initial >diff &&
- diff -u /dev/null diff
-
+ T1=`git write-tree` &&
+ test "$T0" = "$T1"
'
test_expect_success 'apply in reverse' '
+ git reset --hard second &&
git apply --reverse --binary --index patch &&
git diff >diff &&
diff -u /dev/null diff
'
+test_expect_success 'setup separate repository lacking postimage' '
+
+ git tar-tree initial initial | tar xf - &&
+ (
+ cd initial && git init-db && git add .
+ ) &&
+
+ git tar-tree second second | tar xf - &&
+ (
+ cd second && git init-db && git add .
+ )
+
+'
+
+test_expect_success 'apply in forward without postimage' '
+
+ T0=`git rev-parse "second^{tree}"` &&
+ (
+ cd initial &&
+ git apply --index --binary ../patch &&
+ T1=`git write-tree` &&
+ test "$T0" = "$T1"
+ )
+'
+
+test_expect_success 'apply in reverse without postimage' '
+
+ T0=`git rev-parse "initial^{tree}"` &&
+ (
+ cd second &&
+ git apply --index --binary --reverse ../patch &&
+ T1=`git write-tree` &&
+ test "$T0" = "$T1"
+ )
+'
+
test_done