commit 86ac67ee6b540a7f7f920072d9dbc3c88ba174b8 from: Stefan Sperling date: Thu Jul 25 10:01:57 2019 UTC check committed diffs in some histedit tests commit - 0160a755b4f7164a83ab4541c5586efe3b3e5363 commit + 86ac67ee6b540a7f7f920072d9dbc3c88ba174b8 blob - 656ca5c8317ff5ec005bd1bb6b87ce8ceccab834 blob + cde31f60daced55de0572d97c31c11a5aeb3164b --- regress/cmdline/histedit.sh +++ 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,7 +121,18 @@ 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" }