diff options
author | Denton Liu <liu.denton@gmail.com> | 2019-11-12 23:07:45 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-11-21 00:41:51 (GMT) |
commit | 2c9e125b2727c33dccdba1b2a46f462b77e10bed (patch) | |
tree | b9c9513330c4962c4e945c80457683c09892971c /t/t3432-rebase-fast-forward.sh | |
parent | 8cb7980382855f9f696924fec70ed88ea6895030 (diff) | |
download | git-2c9e125b2727c33dccdba1b2a46f462b77e10bed.zip git-2c9e125b2727c33dccdba1b2a46f462b77e10bed.tar.gz git-2c9e125b2727c33dccdba1b2a46f462b77e10bed.tar.bz2 |
t: teach test_cmp_rev to accept ! for not-equals
In the case where we are using test_cmp_rev() to report not-equals, we
write `! test_cmp_rev`. However, since test_cmp_rev() contains
r1=$(git rev-parse --verify "$1") &&
r2=$(git rev-parse --verify "$2") &&
`! test_cmp_rev` will succeed if any of the rev-parses fail. This
behavior is not desired. We want the rev-parses to _always_ be
successful.
Rewrite test_cmp_rev() to optionally accept "!" as the first argument to
do a not-equals comparison. Rewrite `! test_cmp_rev` to `test_cmp_rev !`
in all tests to take advantage of this new functionality.
Also, rewrite the rev-parse logic to end with a `|| return 1` instead of
&&-chaining into the rev-comparison logic. This makes it obvious to
future readers that we explicitly intend on returning early if either of
the rev-parses fail.
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3432-rebase-fast-forward.sh')
-rwxr-xr-x | t/t3432-rebase-fast-forward.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t3432-rebase-fast-forward.sh b/t/t3432-rebase-fast-forward.sh index 034ffc7..92f95b5 100755 --- a/t/t3432-rebase-fast-forward.sh +++ b/t/t3432-rebase-fast-forward.sh @@ -64,7 +64,7 @@ test_rebase_same_head_ () { test_cmp_rev \$oldhead \$newhead elif test $cmp = diff then - ! test_cmp_rev \$oldhead \$newhead + test_cmp_rev ! \$oldhead \$newhead fi " } |