Re: [PATCH 1/3] test-terminal: give the child an empty stdin TTY

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thomas Rast wrote:

> I'm not sure I understand what you are arguing for or why.  That I
> avoid wasting a Pty, and only replace stdin with /dev/null?

Sorry, I was thinking narrowly about the "git log" tests in
t7006-pager.sh.  I was saying that there, the fact that
lib-terminal.sh creates an environment in which stdin is not
guaranteed to be a terminal is a feature, not a bug, since it improves
the test coverage (and I tend to find the "stdin not a tty" case more
interesting).

That said, a test for the implicit HEAD behavior of "git shortlog"
would be a welcome addition to t4201-shortlog.sh, and we might need a
helper "test_with_stdin_as_a_terminal" for that.

The tests you mentioned in t7006 are just buggy --- it was just meant
to make sure we don't regress in the change introduced by 773b69bf
("shortlog: run setup_git_directory_gently() sooner"), and I doubt I
was thinking about the "implicit HEAD when stdin is a tty" behavior at
all.  So independently of everything else, I believe we should do the
following.

-- >8 --
Subject: test: do not let "git shortlog" DWIM based on tty

In the spirit of v1.7.3.3~14^2 (t4203: do not let "git shortlog" DWIM
based on tty, 2010-10-19), do not leave out the revision argument to
"git shortlog" and rely on the default of HEAD in the usual case that
standard input is not connected to a terminal.  Otherwise, tests break
when you do

  git rev-list <range> |
  while read sha; do
    git checkout sha
    make test
  done

Reported-by: Thomas Rast <trast@xxxxxxxxxxxxxxx>
Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
 t/t7006-pager.sh |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index 320e1d1d..6f05b11a 100755
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
@@ -409,14 +409,14 @@ test_GIT_PAGER_overrides  expect_success test_must_fail 'git -p'
 
 test_doesnt_paginate      expect_failure test_must_fail 'git -p nonsense'
 
-test_pager_choices                       'git shortlog'
+test_pager_choices                       'git shortlog HEAD'
 test_expect_success 'setup: configure shortlog not to paginate' '
 	git config pager.shortlog false
 '
-test_doesnt_paginate      expect_success 'git shortlog'
-test_no_local_config_subdir expect_success 'git shortlog'
-test_default_pager        expect_success 'git -p shortlog'
-test_core_pager_subdir    expect_success 'git -p shortlog'
+test_doesnt_paginate      expect_success 'git shortlog HEAD'
+test_no_local_config_subdir expect_success 'git shortlog HEAD'
+test_default_pager        expect_success 'git -p shortlog HEAD'
+test_core_pager_subdir    expect_success 'git -p shortlog HEAD'
 
 test_core_pager_subdir    expect_success test_must_fail \
 					 'git -p apply </dev/null'
-- 
1.7.8

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]