Skip to content

Commit d223e85

Browse files
Martin Ågrengitster
authored andcommitted
t3200: don't grep for strerror() string
In 6b70930 ("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 4605a73 ("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 4605a73, grep for the beginning of the string instead to avoid relying on `strerror()` behavior. Reported-by: Randall S. Becker <[email protected]> Signed-off-by: Martin Ågren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent dc44639 commit d223e85

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

t/t3200-branch.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ test_expect_success '--set-upstream-to fails on locked config' '
870870
>.git/config.lock &&
871871
git branch locked &&
872872
test_must_fail git branch --set-upstream-to locked 2>err &&
873-
test_i18ngrep "could not lock config file .git/config: File exists" err
873+
test_i18ngrep "could not lock config file .git/config" err
874874
'
875875

876876
test_expect_success 'use --set-upstream-to modify HEAD' '
@@ -901,7 +901,7 @@ test_expect_success '--unset-upstream should fail if config is locked' '
901901
git branch --set-upstream-to locked &&
902902
>.git/config.lock &&
903903
test_must_fail git branch --unset-upstream 2>err &&
904-
test_i18ngrep "could not lock config file .git/config: File exists" err
904+
test_i18ngrep "could not lock config file .git/config" err
905905
'
906906

907907
test_expect_success 'test --unset-upstream on HEAD' '

0 commit comments

Comments
 (0)