commit 0c09d1ae432af00c05d25b2ad539416e6932deb8 from: Sven M. Hallberg date: Wed Aug 07 07:43:38 2024 UTC regress/cmdline: add test_rebase_header_order commit - d106871cc560c1985e7c6fbc4a949d2d946158a0 commit + 0c09d1ae432af00c05d25b2ad539416e6932deb8 blob - 61dba33b2a2784aa595f49cae1dea5dde21166fc blob + 54e6c18681c4e3491835b8dcf2d4a04e10606d0b --- regress/cmdline/rebase.sh +++ regress/cmdline/rebase.sh @@ -1065,6 +1065,52 @@ test_rebase_preserves_author_time() { test_done "$testroot" "$ret" } +test_rebase_header_order() { + local testroot=`test_init rebase_header_order` + local committer="Flan Luck " + + git -C $testroot/repo checkout -q -b newbranch + echo "modified delta on branch" > $testroot/repo/gamma/delta + git_commit $testroot/repo -m "modified delta on newbranch" + + git -C $testroot/repo checkout -q master + echo "modified zeta on master" > $testroot/repo/epsilon/zeta + git_commit $testroot/repo -m "committing to zeta on master" + local master_commit=`git_show_head $testroot/repo` + + got checkout $testroot/repo $testroot/wt > /dev/null + ret=$? + if [ $ret -ne 0 ]; then + test_done "$testroot" "$ret" + return 1 + fi + + sleep 1 # get a new timestamp + (cd $testroot/wt && env GOT_AUTHOR="$committer" got rebase newbranch \ + > /dev/null 2> $testroot/stderr) + + echo -n > $testroot/stderr.expected + cmp -s $testroot/stderr.expected $testroot/stderr + ret=$? + if [ $ret -ne 0 ]; then + diff -u $testroot/stderr.expected $testroot/stderr + test_done "$testroot" "$ret" + return 1 + fi + + echo "from:\nvia:\ndate:\norig:" > $testroot/headers.expected + (cd $testroot/wt && got log -c newbranch -l1 | \ + egrep '^(from:|via:|date:|orig:)' | sed -e 's/: .*/:/' \ + > $testroot/headers) + cmp -s $testroot/headers.expected $testroot/headers + ret=$? + if [ $ret -ne 0 ]; then + diff -u $testroot/headers.expected $testroot/headers + fi + + test_done "$testroot" "$ret" +} + test_rebase_no_commits_to_rebase() { local testroot=`test_init rebase_no_commits_to_rebase` @@ -2350,6 +2396,7 @@ run_test test_rebase_in_progress run_test test_rebase_path_prefix run_test test_rebase_preserves_logmsg run_test test_rebase_preserves_author_time +run_test test_rebase_header_order run_test test_rebase_no_commits_to_rebase run_test test_rebase_forward run_test test_rebase_forward_path_prefix