Skip to contentSkip to conversation

t5500-fetch-pack: ignore output from git init

PATCH In review Stephen Boyd 2 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t5500-fetch-pack: ignore output from git init

---
 t/t5500-fetch-pack.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
t/t5500-fetch-pack.sh +1 -1
index c450f33..ce74508 100755
@@ -97,7 +97,7 @@ pull_to_client () {
 (
 	mkdir client &&
 	cd client &&
-	git init 2>> log2.txt &&
+	git init 2>> log2.txt > /dev/null &&
 	git config transfer.unpacklimit 0
 )
 
Signature · 1 line
1.6.3.1.145.gb74d77
#1 lore raw
Quoted 1 line · Stephen Boyd

There is no rationale given in the commit message, but I assume it is "this spews useless crap to the terminal that interferes with the usual test output".

However, this seems like the wrong direction. We already have a nice test infrastructure that redirects test output away from the user and respects "--verbose" to turn it back on. t5500 does quite a bit of work outside the test harness, and it makes more sense to me to move it inside. That would take care of your useless spew, _and_ it would help detect failures in a more robust way.

In other words:

t/t5500-fetch-pack.sh pull_to_client () { · line 102

Quoted 12 lines
t/t5500-fetch-pack.sh +1 -1
index c450f33..ce74508 100755
@@ -97,7 +97,7 @@ pull_to_client () {
 (
 	mkdir client &&
 	cd client &&
-	git init 2>> log2.txt &&
+	git init 2>> log2.txt > /dev/null &&
 	git config transfer.unpacklimit 0
 )

Why not:

test_expect_success 'setup client repo' '

    mkdir client &&
    (cd client &&
     git init 2>>log2.txt &&
     git config transfer.unpacklimit 0
    )

'

?

-Peff

#2 lore raw
Quoted 12 lines · Jeff King

t/t5500-fetch-pack.sh pull_to_client () { · line 102

Quoted 9 lines

+++ b/t/t5500-fetch-pack.sh

t/t5500-fetch-pack.sh +1 -1
@@ -97,7 +97,7 @@ pull_to_client () {
 (
 	mkdir client &&
 	cd client &&
-	git init 2>> log2.txt &&
+	git init 2>> log2.txt > /dev/null &&
 	git config transfer.unpacklimit 0
 )

Why not:

Quoted 7 lines

test_expect_success 'setup client repo' '

    mkdir client &&
    (cd client &&
     git init 2>>log2.txt &&
     git config transfer.unpacklimit 0
    )

'

Actually, taking a closer look at the script, I think you could probably ditch the '2>>log2.txt' bit entirely. The log file is never read and appears to be completely for debugging. Putting the code into the test harness means that output will respect --verbose properly, which means a separate log is unnecessary.

-Peff

#3 lore raw
Quoted 7 lines · Jeff King

Actually, taking a closer look at the script, I think you could probably ditch the '2>>log2.txt' bit entirely. The log file is never read and appears to be completely for debugging. Putting the code into the test harness means that output will respect --verbose properly, which means a separate log is unnecessary.

-Peff

Yeah I sent this off real quick because of the reason you state (terminal crap). In the end, the test really needs to be modernized. If someone else doesn't get around to it, I'll start seeing what I can do to make it better.