Message ID | dfa27d7a8e7e0a9e03e228653ebff639a449ac77.1631094563.git.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | rebase: dereference tags | expand |
On Wed, Sep 08 2021, Phillip Wood via GitGitGadget wrote: > @@ -54,9 +54,9 @@ testrebase() { > echo d >> a && > git add a && > test_must_fail git rebase --continue && > - test $(git rev-parse HEAD) != $(git rev-parse main) && > + ! test_cmp_rev HEAD main && Use "test_cmp_rev !", making the shell do the negation is troublesome for the same reason we don't do it with git command, it potentially hides segfaults (and that test helper invokes "git", hence the optional "!" first rgument).
On 08/09/2021 11:40, Ævar Arnfjörð Bjarmason wrote: > > On Wed, Sep 08 2021, Phillip Wood via GitGitGadget wrote: > >> @@ -54,9 +54,9 @@ testrebase() { >> echo d >> a && >> git add a && >> test_must_fail git rebase --continue && >> - test $(git rev-parse HEAD) != $(git rev-parse main) && >> + ! test_cmp_rev HEAD main && > > Use "test_cmp_rev !", making the shell do the negation is troublesome > for the same reason we don't do it with git command, it potentially > hides segfaults (and that test helper invokes "git", hence the optional > "!" first argument). Thanks, I didn't realize one could pass "!" to test_cmp_rev - it gives a better message on failure as well as avoiding hidden segfaults Best Wishes Phillip
diff --git a/t/t3407-rebase-abort.sh b/t/t3407-rebase-abort.sh index 0ad21966bc5..8d913d73bad 100755 --- a/t/t3407-rebase-abort.sh +++ b/t/t3407-rebase-abort.sh @@ -29,7 +29,7 @@ testrebase() { test_must_fail git rebase$type main && test_path_is_dir "$dotest" && git rebase --abort && - test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) && + test_cmp_rev to-rebase pre-rebase && test ! -d "$dotest" ' @@ -39,9 +39,9 @@ testrebase() { test_must_fail git rebase$type main && test_path_is_dir "$dotest" && test_must_fail git rebase --skip && - test $(git rev-parse HEAD) = $(git rev-parse main) && + test_cmp_rev HEAD main && git rebase --abort && - test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) && + test_cmp_rev to-rebase pre-rebase && test ! -d "$dotest" ' @@ -54,9 +54,9 @@ testrebase() { echo d >> a && git add a && test_must_fail git rebase --continue && - test $(git rev-parse HEAD) != $(git rev-parse main) && + ! test_cmp_rev HEAD main && git rebase --abort && - test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) && + test_cmp_rev to-rebase pre-rebase && test ! -d "$dotest" ' @@ -91,7 +91,7 @@ test_expect_success 'rebase --apply --quit' ' test_path_is_dir .git/rebase-apply && head_before=$(git rev-parse HEAD) && git rebase --quit && - test $(git rev-parse HEAD) = $head_before && + test_cmp_rev HEAD $head_before && test ! -d .git/rebase-apply ' @@ -102,7 +102,7 @@ test_expect_success 'rebase --merge --quit' ' test_path_is_dir .git/rebase-merge && head_before=$(git rev-parse HEAD) && git rebase --quit && - test $(git rev-parse HEAD) = $head_before && + test_cmp_rev HEAD $head_before && test ! -d .git/rebase-merge '