[PATCH v2 2/3] t3501: don't ignore "git <cmd>" exit code
- From
Labnann <khalid.masum.92@gmail.com>
- Date
- Mar 31, 2022, 19:15 UTC
- Message-ID
- <20220331191525.17927-3-khalid.masum.92@gmail.com>
- In-Reply-To
- <20220331191525.17927-1-khalid.masum.92@gmail.com>
without this change this test will become flaky e.g under SANITIZE=leak if some (but not all) memory leaks revealed by these commands, according to c419562860e
Signed-off-by: Labnann <khalid.masum.92@gmail.com> --- t/t3501-revert-cherry-pick.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh index 45492a7ed0..bd19c272d6 100755 --- a/t/t3501-revert-cherry-pick.sh +++ b/t/t3501-revert-cherry-pick.sh @@ -44,6 +44,12 @@ test_expect_success setup ' git tag rename2 ' +test_cmp_rev_parse () { + git rev-parse $1 >expect && + git rev-parse $2 >actual && + test_cmp expect actual +} + test_expect_success 'cherry-pick --nonsense' ' pos=$(git rev-parse HEAD) && @@ -66,7 +72,7 @@ test_expect_success 'cherry-pick after renaming branch' ' git checkout rename2 && git cherry-pick added && - test $(git rev-parse HEAD^) = $(git rev-parse rename2) && + test_cmp_rev_parse HEAD^ rename2 && test_path_is_file opos && grep "Add extra line at the end" opos && git reflog -1 | grep cherry-pick @@ -77,7 +83,7 @@ test_expect_success 'revert after renaming branch' ' git checkout rename1 && git revert added && - test $(git rev-parse HEAD^) = $(git rev-parse rename1) && + test_cmp_rev_parse HEAD^ rename1 && test_path_is_file spoo && ! grep "Add extra line at the end" spoo && git reflog -1 | grep revert
-- 2.35.1