commit 99fe3033f2c5c27a510a69c329fb1a542c4620cf from: Christian Weisgerber via: Thomas Adam date: Wed Mar 08 09:24:33 2023 UTC add xfail test for histedit folding of delete followed by add If a file is deleted, then in modified form added again, folding should restore the file with its new contents. ok stsp commit - 31a4bd82de06791beb82e8f570cc0236202acca5 commit + 99fe3033f2c5c27a510a69c329fb1a542c4620cf blob - 7f41dbf2a6228ff4edc4bb8fd6d844625b1b6dc5 blob + b4517778fe90cf2ff3cb089a57a6fc0b911217dc --- regress/cmdline/histedit.sh +++ regress/cmdline/histedit.sh @@ -1543,6 +1543,63 @@ test_histedit_fold_add_delete() { ret=$? if [ $ret -ne 0 ]; then diff -u $testroot/stdout.expected $testroot/stdout + fi + test_done "$testroot" "$ret" +} + +test_histedit_fold_delete_add() { + local testroot=`test_init histedit_fold_delete_add` + + local orig_commit=`git_show_head $testroot/repo` + + (cd $testroot/repo && git rm -q alpha) + git_commit $testroot/repo -m "removing alpha" + local old_commit1=`git_show_head $testroot/repo` + + echo "modified alpha" >$testroot/repo/alpha + (cd $testroot/repo && git add alpha) + git_commit $testroot/repo -m "add back modified alpha" + local old_commit2=`git_show_head $testroot/repo` + + got checkout -c $orig_commit $testroot/repo $testroot/wt > /dev/null + ret=$? + if [ $ret -ne 0 ]; then + test_done "$testroot" "$ret" + return 1 + fi + + echo "fold $old_commit1" > $testroot/histedit-script + echo "pick $old_commit2" >> $testroot/histedit-script + echo "mesg folded changes" >> $testroot/histedit-script + + (cd $testroot/wt && got histedit -F $testroot/histedit-script \ + > $testroot/stdout) + + local new_commit1=`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` + + echo "D alpha" > $testroot/stdout.expected + echo "$short_old_commit1 -> fold commit: removing alpha" \ + >> $testroot/stdout.expected + echo "A alpha" >> $testroot/stdout.expected + echo "$short_old_commit2 -> $short_new_commit1: folded changes" \ + >> $testroot/stdout.expected + echo "Switching work tree to refs/heads/master" \ + >> $testroot/stdout.expected + + #cmp -s $testroot/stdout.expected $testroot/stdout + #ret=$? + #if [ $ret -ne 0 ]; then + # diff -u $testroot/stdout.expected $testroot/stdout + # test_done "$testroot" "$ret" + # return 1 + #fi + + if [ ! -e $testroot/wt/alpha ]; then + ret="xfail fold deleted and added file" fi test_done "$testroot" "$ret" } @@ -2467,6 +2524,7 @@ run_test test_histedit_fold_last_commit_swap run_test test_histedit_split_commit run_test test_histedit_duplicate_commit_in_script run_test test_histedit_fold_add_delete +run_test test_histedit_fold_delete_add run_test test_histedit_fold_only run_test test_histedit_fold_only_empty_logmsg run_test test_histedit_edit_only