Skip to contentSkip to conversation

log: Non-zero exit code?

BUG Ramkumar Ramachandra 2 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hi,

Here's a quick patch to illustrate the bug report. I initially thought Bo Yang's series was at fault, but a quick checkout-make tells me that the problem is much deeper- Am I doing something wrong? How did we not notice this problem for so long?

-- 8< --
From: Ramkumar Ramachandra <[email protected]>
Date: Sat, 21 Aug 2010 11:44:13 +0530
Subject: [PATCH] log: test to check exit code

Add a test to check the exit code of a simple 'git log' invocation. The test currently fails: the exit code seems to be 141, instead of the expected 0.

---
 t/t4202-log.sh |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
t/t4202-log.sh +6 -0
index 2e51356..bd05bc9 100755
@@ -37,6 +37,12 @@ test_expect_success setup '
 
 '
 
+test_expect_success 'exit code' '
+
+        git log
+        test_cmp $? 0
+'
+
 printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect
 test_expect_success 'pretty' '
 
Signature · 1 line
1.7.2.2.409.gdbb11.dirty
#1 lore raw

Hi,

Quoted 5 lines
t/t4202-log.sh +0 -0
index 2e51356..bd05bc9 100755

t/t4202-log.sh test_expect_success setup ' · line 45

Quoted 9 lines
t/t4202-log.sh +6 -0
@@ -37,6 +37,12 @@ test_expect_success setup '
 
 '
 
+test_expect_success 'exit code' '
+
+        git log
+        test_cmp $? 0
+'
+

Er, I meant test $? = 0.

-- Ram

#2 lore raw
In reply to Ramkumar Ramachandra

Am 21.08.2010 08:22, schrieb Ramkumar Ramachandra:

Quoted 40 lines

Hi,

Here's a quick patch to illustrate the bug report. I initially thought Bo Yang's series was at fault, but a quick checkout-make tells me that the problem is much deeper- Am I doing something wrong? How did we not notice this problem for so long?

-- 8< --
From: Ramkumar Ramachandra <[email protected]>
Date: Sat, 21 Aug 2010 11:44:13 +0530
Subject: [PATCH] log: test to check exit code

Add a test to check the exit code of a simple 'git log' invocation. The test currently fails: the exit code seems to be 141, instead of the expected 0.

---
 t/t4202-log.sh |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
t/t4202-log.sh +6 -0
index 2e51356..bd05bc9 100755
@@ -37,6 +37,12 @@ test_expect_success setup '
 
 '
 
+test_expect_success 'exit code' '
+
+        git log
+        test_cmp $? 0
+'
+
 printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect
 test_expect_success 'pretty' '
 

Er, I meant test $? = 0.

Quoted 1 line

-- Ram

You can leave out the test line entirely, as test_expect_success already checks for an exit code of zero.

The test passes for me with 1.7.2.2, next and pu. Which version of git do you use?

Error code 141 smells like the pager. Can you reproduce the problem without the pager, i.e. like this?

	git --no-pager log

René

#3 lore raw

Hi René,

Quoted 2 lines · René Scharfe

You can leave out the test line entirely, as test_expect_success already checks for an exit code of zero.

Right. I should have actually read test-lib.sh before submitting a test :p

Quoted 2 lines

The test passes for me with 1.7.2.2, next and pu. Which version of git do you use?

I can reproduce this on the latest master and pu.

Quoted 4 lines

Error code 141 smells like the pager. Can you reproduce the problem without the pager, i.e. like this?

	git --no-pager log

Indeed, it's a pager problem as Ævar pointed out on IRC. $(git --no-pager log) and $(GIT_PAGER='perl -pe ""' git log) return
0. Something in less changed?

-- Ram