commit 09209b8a13411e9d8464267c5e65c2c848455496 from: Stefan Sperling date: Fri Oct 08 08:34:39 2021 UTC add test for merge result when lines are inserted at the top of a file Based on a patch by Omar Polo commit - aaef19b43a34ed335737d733fbfea51056f2e2bb commit + 09209b8a13411e9d8464267c5e65c2c848455496 blob - 051f0bedccbe45d193bdeb08943bd0f9767a2f04 blob + 3dc4a6ab158e29a3c8676f7101028ffc33ea2efc --- regress/cmdline/histedit.sh +++ regress/cmdline/histedit.sh @@ -1916,7 +1916,63 @@ EOF fi test_done "$testroot" "$ret" } + +test_histedit_prepend_line() { + local testroot=`test_init histedit_prepend_line` + local orig_commit=`git_show_head $testroot/repo` + + got checkout $testroot/repo $testroot/wt > /dev/null + + ed "$testroot/wt/alpha" </dev/null 2>&1 +0i +first line +. +wq +EOF + + cp $testroot/wt/alpha $testroot/content.expected + (cd $testroot/wt/ && got commit -m 'modified alpha on master' \ + alpha > /dev/null) + ret="$?" + if [ "$?" != 0 ]; then + echo "got commit failed unexpectedly" >&2 + test_done "$testroot" "$ret" + return 1 + fi + + local top_commit=`git_show_head $testroot/repo` + echo "pick $top_commit" > "$testroot/histedit-script" + + (cd $testroot/wt/ && got update -c $orig_commit > /dev/null) + ret="$?" + if [ "$?" != 0 ]; then + echo "got update failed unexpectedly" >&2 + test_done "$testroot" "$ret" + return 1 + fi + + (cd $testroot/wt && got histedit -F "$testroot/histedit-script" \ + > /dev/null) + ret="$?" + if [ "$?" != 0 ]; then + echo "got histedit failed unexpectedly" >&2 + test_done "$testroot" "$ret" + return 1 + fi + + cp $testroot/wt/alpha $testroot/content + cmp -s $testroot/content.expected $testroot/content + ret="$?" + if [ "$ret" != "0" ]; then + diff -u $testroot/content.expected $testroot/content + test_done "$testroot" "$ret" + return 1 + fi + + test_done "$testroot" $ret +} + test_parseargs "$@" run_test test_histedit_no_op run_test test_histedit_swap @@ -1936,3 +1992,4 @@ run_test test_histedit_fold_add_delete run_test test_histedit_fold_only run_test test_histedit_fold_only_empty_logmsg run_test test_histedit_edit_only +run_test test_histedit_prepend_line