]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t4153: stop redirecting input from /dev/zero
authorJeff King <peff@peff.net>
Wed, 17 Jul 2024 07:00:50 +0000 (03:00 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 17 Jul 2024 15:31:27 +0000 (08:31 -0700)
Commit 852a171018 (am: let command-line options override saved options,
2015-08-04) redirected a few "git am" invocations from /dev/zero, even
though it did not expect "am" to read the input. This was necessary at
the time because those tests used test_terminal, and as described in
18d8c26930 (test_terminal: redirect child process' stdin to a pty,
2015-08-04):

  Note that due to the way the code is structured, the child's stdin
  pseudo-tty will be closed when we finish reading from our stdin. This
  means that in the common case, where our stdin is attached to /dev/null,
  the child's stdin pseudo-tty will be closed immediately. Some operations
  like isatty(), which git-am uses, require the file descriptor to be
  open, and hence if the success of the command depends on such functions,
  test_terminal's stdin should be redirected to a source with large amount
  of data to ensure that the child's stdin is not closed, e.g.

              test_terminal git am --3way </dev/zero

But we later dropped the use of test_terminal in 53ce2e3f0a (am: add
explicit "--retry" option, 2024-06-06). That commit dropped one of the
redirections from /dev/zero but not the other.

In theory the remaining one should not cause any problems, but it turns
out that at least one platform (NonStop) does not have /dev/zero at all.
We never noticed before because it also did not pass the TTY prereq,
meaning these tests were not run at all there until 53ce2e3f0a.

So let's drop the useless /dev/zero mention. There are others in the
test suite, but they are run only for tests marked with EXPENSIVE (so
not typically by default).

Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t4153-am-resume-override-opts.sh

index a32cec42aa4ba02f0ff563cc3d675e2d0c24df06..9bec989a0ed71caf768c6e3e19bdbda814c23e1e 100755 (executable)
@@ -98,7 +98,7 @@ test_expect_success '--reject overrides --no-reject' '
        test_path_is_dir .git/rebase-apply &&
        test_path_is_missing file.rej &&
 
-       test_must_fail git am --retry --reject </dev/zero &&
+       test_must_fail git am --retry --reject &&
        test_path_is_dir .git/rebase-apply &&
        test_path_is_file file.rej
 '