commit ad324bf53a11587dc227a2c00b65020595aa18dc from: Stefan Sperling date: Tue Sep 21 20:27:45 2021 UTC fix histedit_no_op test which was failing randomly A no-op replayed history ends up having exactly the same commit IDs if all commits are created at roughly the same moment in time. There are no content changes involved so if commit timestamps do not differ then commit hashes will be the same. In which case there is no fork in history for 'got histedit -l' to display, yet the test was always expecting a fork in history to be displayed. Update the test to take this issue into account. The test will now pass no matter which result is produced by the histedit operation. Problem found by Lucas who observed that this test was randomly failing. Patch also provided by Lucas. commit - 34c3415fac1e6f7bb8fb803417020063834c6112 commit + ad324bf53a11587dc227a2c00b65020595aa18dc blob - 8c612fafa7e7fd1f96dfce1527ee0b2f621e0f8c blob + 61bcebf99d9b2d05bc608cd43b07f0c9e3cdf818 --- regress/cmdline/histedit.sh +++ regress/cmdline/histedit.sh @@ -28,6 +28,7 @@ test_histedit_no_op() { (cd $testroot/repo && git add epsilon/new) git_commit $testroot/repo -m "committing changes" local old_commit1=`git_show_head $testroot/repo` + local old_author_time1=`git_show_author_time $testroot/repo` echo "modified zeta on master" > $testroot/repo/epsilon/zeta git_commit $testroot/repo -m "committing to zeta on master" @@ -152,6 +153,7 @@ test_histedit_no_op() { # We should have a backup of old commits (cd $testroot/repo && got histedit -l > $testroot/stdout) + d_orig1=`date -u -r $old_author_time1 +"%G-%m-%d"` d_orig2=`date -u -r $old_author_time2 +"%a %b %e %X %Y UTC"` d_new2=`date -u -r $new_author_time2 +"%G-%m-%d"` d_orig=`date -u -r $orig_author_time +"%G-%m-%d"` @@ -165,9 +167,29 @@ date: $d_orig2 has become commit $new_commit2 (master) $d_new2 $GOT_AUTHOR_11 committing to zeta on master -history forked at $orig_commit - $d_orig $GOT_AUTHOR_11 adding the test tree +EOF + + local is_forked=true d_fork fork_commit fork_commit_msg + + if [ "$old_commit1" = "$new_commit1" ]; then + if [ "$old_commit2" = "$new_commit2" ]; then + is_forked=false + else + d_fork=$d_orig1 + fork_commit=$new_commit1 + fork_commit_msg="committing changes" + fi + else + d_fork=$d_orig + fork_commit=$orig_commit + fork_commit_msg="adding the test tree" + fi + + $is_forked && cat >> $testroot/stdout.expected <