From: Martin Ågren Date: Sat, 18 Jul 2020 09:48:40 +0000 (+0200) Subject: t3200: don't grep for `strerror()` string X-Git-Tag: v2.28.0-rc2~3^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d223e85407f75ffb562b6f7b5f33b6135607977a;p=thirdparty%2Fgit.git t3200: don't grep for `strerror()` string In 6b7093064a ("t3200: test for specific errors", 2020-06-15), we learned to grep stderr to ensure that the failing `git branch` invocations fail for the right reason. In two of these tests, we grep for "File exists", expecting the string to show up there since config.c calls `error_errno()`, which ends up including `strerror(errno)` in the error message. But as we saw in 4605a73073 ("t1091: don't grep for `strerror()` string", 2020-03-08), there exists at least one implementation where `strerror()` yields a slightly different string than the one we're grepping for. In particular, these tests fail on the NonStop platform. Similar to 4605a73073, grep for the beginning of the string instead to avoid relying on `strerror()` behavior. Reported-by: Randall S. Becker Signed-off-by: Martin Ågren Signed-off-by: Junio C Hamano --- diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 1fd03cae80..3e87de2a76 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -870,7 +870,7 @@ test_expect_success '--set-upstream-to fails on locked config' ' >.git/config.lock && git branch locked && test_must_fail git branch --set-upstream-to locked 2>err && - test_i18ngrep "could not lock config file .git/config: File exists" err + test_i18ngrep "could not lock config file .git/config" err ' test_expect_success 'use --set-upstream-to modify HEAD' ' @@ -901,7 +901,7 @@ test_expect_success '--unset-upstream should fail if config is locked' ' git branch --set-upstream-to locked && >.git/config.lock && test_must_fail git branch --unset-upstream 2>err && - test_i18ngrep "could not lock config file .git/config: File exists" err + test_i18ngrep "could not lock config file .git/config" err ' test_expect_success 'test --unset-upstream on HEAD' '