check committed diffs in some histedit tests
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
diff --git a/regress/cmdline/histedit.sh b/regress/cmdline/histedit.sh
index 656ca5c..cde31f6 100755
--- a/regress/cmdline/histedit.sh
+++ b/regress/cmdline/histedit.sh
@@ -32,6 +32,9 @@ function test_histedit_no_op {
git_commit $testroot/repo -m "committing to zeta on master"
local old_commit2=`git_show_head $testroot/repo`
+ got diff -r $testroot/repo $orig_commit $old_commit2 \
+ > $testroot/diff.expected
+
got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
ret="$?"
if [ "$ret" != "0" ]; then
@@ -118,6 +121,17 @@ function test_histedit_no_op {
ret="$?"
if [ "$ret" != "0" ]; then
diff -u $testroot/stdout.expected $testroot/stdout
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ got diff -r $testroot/repo $orig_commit $new_commit2 \
+ > $testroot/diff
+ sed -i -e "s/$old_commit2/$new_commit2/" $testroot/diff.expected
+ cmp -s $testroot/diff.expected $testroot/diff
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/diff.expected $testroot/diff
fi
test_done "$testroot" "$ret"
}
@@ -138,6 +152,9 @@ function test_histedit_swap {
git_commit $testroot/repo -m "committing to zeta on master"
local old_commit2=`git_show_head $testroot/repo`
+ got diff -r $testroot/repo $orig_commit $old_commit2 \
+ > $testroot/diff.expected
+
got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
ret="$?"
if [ "$ret" != "0" ]; then
@@ -224,13 +241,23 @@ function test_histedit_swap {
ret="$?"
if [ "$ret" != "0" ]; then
diff -u $testroot/stdout.expected $testroot/stdout
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ got diff -r $testroot/repo $orig_commit $new_commit1 \
+ > $testroot/diff
+ sed -i -e "s/$old_commit2/$new_commit1/" $testroot/diff.expected
+ cmp -s $testroot/diff.expected $testroot/diff
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/diff.expected $testroot/diff
fi
test_done "$testroot" "$ret"
}
function test_histedit_drop {
local testroot=`test_init histedit_drop`
-
local orig_commit=`git_show_head $testroot/repo`
echo "modified alpha on master" > $testroot/repo/alpha
@@ -244,6 +271,9 @@ function test_histedit_drop {
git_commit $testroot/repo -m "committing to zeta on master"
local old_commit2=`git_show_head $testroot/repo`
+ got diff -r $testroot/repo $old_commit1 $old_commit2 \
+ > $testroot/diff.expected
+
got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null
ret="$?"
if [ "$ret" != "0" ]; then
@@ -257,12 +287,10 @@ function test_histedit_drop {
(cd $testroot/wt && got histedit -F $testroot/histedit-script \
> $testroot/stdout)
- local new_commit1=`git_show_parent_commit $testroot/repo`
local new_commit2=`git_show_head $testroot/repo`
local short_old_commit1=`trim_obj_id 28 $old_commit1`
local short_old_commit2=`trim_obj_id 28 $old_commit2`
- local short_new_commit1=`trim_obj_id 28 $new_commit1`
local short_new_commit2=`trim_obj_id 28 $new_commit2`
echo "$short_old_commit1 -> drop commit: committing changes" \
@@ -318,6 +346,18 @@ function test_histedit_drop {
ret="$?"
if [ "$ret" != "0" ]; then
diff -u $testroot/stdout.expected $testroot/stdout
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ got diff -r $testroot/repo $orig_commit $new_commit2 \
+ > $testroot/diff
+ sed -i -e "s/$old_commit1/$orig_commit/" $testroot/diff.expected
+ sed -i -e "s/$old_commit2/$new_commit2/" $testroot/diff.expected
+ cmp -s $testroot/diff.expected $testroot/diff
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/diff.expected $testroot/diff
fi
test_done "$testroot" "$ret"
}