# [PATCH 1/3] t6024-recursive-merge: quiet down this test

6 messages from 2006-12-28 to 2006-12-28. Participants: Eric Wong, Junio C Hamano.
Thread: https://gitlist.dev/t/6141

## Eric Wong, 2006-12-28 09:10

Subject: quieting down git-commit (and init-db) in tests
Message-ID: <11672970521665-git-send-email-normalperson@yhbt.net>
URL: https://gitlist.dev/e/11672970521665-git-send-email-normalperson%40yhbt.net

```
There are more places where the tests have gotten, but I noticed these
the most.  Some non-portable uses of 'export' have been replaced.
I'll try to get to the rest in a day or two, but I'm sleepy and have
more things for git-svn to do.

--
 t/t6024-recursive-merge.sh     |   90 +++++++++++++++++++++-------------------
 t/t9200-git-cvsexportcommit.sh |   10 +++--
 t/test-lib.sh                  |    2 +-
 3 files changed, 54 insertions(+), 48 deletions(-)

-- 
Eric Wong

```

## Eric Wong, 2006-12-28 09:10

Subject: [PATCH 1/3] t6024-recursive-merge: quiet down this test
Message-ID: <11672970542015-git-send-email-normalperson@yhbt.net>
URL: https://gitlist.dev/e/11672970542015-git-send-email-normalperson%40yhbt.net
In-Reply-To: <11672970521665-git-send-email-normalperson@yhbt.net>

```
We get an extra measure of error checking here as well.
While we're at it, also removed a less portable use of export.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 t/t6024-recursive-merge.sh |   90 +++++++++++++++++++++++---------------------
 1 files changed, 47 insertions(+), 43 deletions(-)

diff --git a/t/t6024-recursive-merge.sh b/t/t6024-recursive-merge.sh
index 69b18f7..31b9625 100644
--- a/t/t6024-recursive-merge.sh
+++ b/t/t6024-recursive-merge.sh
@@ -11,50 +11,54 @@ test_description='Test merge without common ancestors'
 #       X   \
 # 2 - C - E - G
 
-export GIT_COMMITTER_DATE="2006-12-12 23:28:00 +0100"
-echo 1 > a1
-git add a1
-GIT_AUTHOR_DATE="2006-12-12 23:00:00" git commit -m 1 a1
-
-git checkout -b A master
-echo A > a1
-GIT_AUTHOR_DATE="2006-12-12 23:00:01" git commit -m A a1
-
-git checkout -b B master
-echo B > a1
-GIT_AUTHOR_DATE="2006-12-12 23:00:02" git commit -m B a1
-
-git checkout -b D A
-git-rev-parse B > .git/MERGE_HEAD
-echo D > a1
-git update-index a1
-GIT_AUTHOR_DATE="2006-12-12 23:00:03" git commit -m D
-
-git symbolic-ref HEAD refs/heads/other
-echo 2 > a1
-GIT_AUTHOR_DATE="2006-12-12 23:00:04" git commit -m 2 a1
-
-git checkout -b C
-echo C > a1
-GIT_AUTHOR_DATE="2006-12-12 23:00:05" git commit -m C a1
-
-git checkout -b E C
-git-rev-parse B > .git/MERGE_HEAD
-echo E > a1
-git update-index a1
-GIT_AUTHOR_DATE="2006-12-12 23:00:06" git commit -m E
-
-git checkout -b G E
-git-rev-parse A > .git/MERGE_HEAD
-echo G > a1
-git update-index a1
-GIT_AUTHOR_DATE="2006-12-12 23:00:07" git commit -m G
-
-git checkout -b F D
-git-rev-parse C > .git/MERGE_HEAD
-echo F > a1
-git update-index a1
+GIT_COMMITTER_DATE="2006-12-12 23:28:00 +0100"
+export GIT_COMMITTER_DATE
+
+test_expect_success "setup tests" '
+echo 1 > a1 &&
+git add a1 &&
+GIT_AUTHOR_DATE="2006-12-12 23:00:00" git commit -m 1 a1 &&
+
+git checkout -b A master &&
+echo A > a1 &&
+GIT_AUTHOR_DATE="2006-12-12 23:00:01" git commit -m A a1 &&
+
+git checkout -b B master &&
+echo B > a1 &&
+GIT_AUTHOR_DATE="2006-12-12 23:00:02" git commit -m B a1 &&
+
+git checkout -b D A &&
+git-rev-parse B > .git/MERGE_HEAD &&
+echo D > a1 &&
+git update-index a1 &&
+GIT_AUTHOR_DATE="2006-12-12 23:00:03" git commit -m D &&
+
+git symbolic-ref HEAD refs/heads/other &&
+echo 2 > a1 &&
+GIT_AUTHOR_DATE="2006-12-12 23:00:04" git commit -m 2 a1 &&
+
+git checkout -b C &&
+echo C > a1 &&
+GIT_AUTHOR_DATE="2006-12-12 23:00:05" git commit -m C a1 &&
+
+git checkout -b E C &&
+git-rev-parse B > .git/MERGE_HEAD &&
+echo E > a1 &&
+git update-index a1 &&
+GIT_AUTHOR_DATE="2006-12-12 23:00:06" git commit -m E &&
+
+git checkout -b G E &&
+git-rev-parse A > .git/MERGE_HEAD &&
+echo G > a1 &&
+git update-index a1 &&
+GIT_AUTHOR_DATE="2006-12-12 23:00:07" git commit -m G &&
+
+git checkout -b F D &&
+git-rev-parse C > .git/MERGE_HEAD &&
+echo F > a1 &&
+git update-index a1 &&
 GIT_AUTHOR_DATE="2006-12-12 23:00:08" git commit -m F
+'
 
 test_expect_failure "combined merge conflicts" "git merge -m final G"
 
-- 
1.4.4.3.gd4ada

```

## Eric Wong, 2006-12-28 09:10

Subject: [PATCH 2/3] test-lib: quiet down init-db output for tests
Message-ID: <11672970561224-git-send-email-normalperson@yhbt.net>
URL: https://gitlist.dev/e/11672970561224-git-send-email-normalperson%40yhbt.net
In-Reply-To: <11672970542015-git-send-email-normalperson@yhbt.net>

```
I don't think anybody running tests needs to know they're
running init-db and creating a repository for testing.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 t/test-lib.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index f0f9cd6..ad2b6f6 100755
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -176,7 +176,7 @@ test_create_repo () {
 	repo="$1"
 	mkdir "$repo"
 	cd "$repo" || error "Cannot setup test environment"
-	"$GIT_EXEC_PATH/git" init-db --template=$GIT_EXEC_PATH/templates/blt/ 2>/dev/null ||
+	"$GIT_EXEC_PATH/git" init-db --template=$GIT_EXEC_PATH/templates/blt/ >/dev/null 2>&1 ||
 	error "cannot run git init-db -- have you built things yet?"
 	mv .git/hooks .git/hooks-disabled
 	cd "$owd"
-- 
1.4.4.3.gd4ada

```

## Eric Wong, 2006-12-28 09:10

Subject: [PATCH 3/3] t9200-git-cvsexportcommit.sh: quiet down commit
Message-ID: <11672970581666-git-send-email-normalperson@yhbt.net>
URL: https://gitlist.dev/e/11672970581666-git-send-email-normalperson%40yhbt.net
In-Reply-To: <11672970561224-git-send-email-normalperson@yhbt.net>

```
Also, fixed an unportable use of 'export'.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 t/t9200-git-cvsexportcommit.sh |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh
index ca0513b..315119a 100755
--- a/t/t9200-git-cvsexportcommit.sh
+++ b/t/t9200-git-cvsexportcommit.sh
@@ -14,16 +14,18 @@ then
     exit
 fi
 
-export CVSROOT=$(pwd)/cvsroot
-export CVSWORK=$(pwd)/cvswork
+CVSROOT=$(pwd)/cvsroot
+CVSWORK=$(pwd)/cvswork
+GIT_DIR=$(pwd)/.git
+export CVSROOT CVSWORK GIT_DIR
+
 rm -rf "$CVSROOT" "$CVSWORK"
 mkdir "$CVSROOT" &&
 cvs init &&
 cvs -Q co -d "$CVSWORK" . &&
-export GIT_DIR=$(pwd)/.git &&
 echo >empty &&
 git add empty &&
-git commit -a -m "Initial" 2>/dev/null ||
+git commit -q -a -m "Initial" 2>/dev/null ||
 exit 1
 
 test_expect_success \
-- 
1.4.4.3.gd4ada

```

## Junio C Hamano, 2006-12-28 09:24

Subject: Re: [PATCH 3/3] t9200-git-cvsexportcommit.sh: quiet down commit
Message-ID: <7vfyb0wexo.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vfyb0wexo.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <11672970581666-git-send-email-normalperson@yhbt.net>

```
Eric Wong <normalperson@yhbt.net> writes:

> Also, fixed an unportable use of 'export'.

As a traditionalist, I tend to prefer "var=val; export var" over
"export var=val" myself, but I wonder how unportable this is
these days.

Just wondering, no objection.

Do you have a specific shell in mind that groks other constructs
used in our tests but not "export var=val" form?

```

## Eric Wong, 2006-12-28 18:14

Subject: Re: [PATCH 3/3] t9200-git-cvsexportcommit.sh: quiet down commit
Message-ID: <20061228181448.GA17775@localdomain>
URL: https://gitlist.dev/e/20061228181448.GA17775%40localdomain
In-Reply-To: <7vfyb0wexo.fsf@assigned-by-dhcp.cox.net>

```
Junio C Hamano <junkio@cox.net> wrote:
> Eric Wong <normalperson@yhbt.net> writes:
> 
> > Also, fixed an unportable use of 'export'.
> 
> As a traditionalist, I tend to prefer "var=val; export var" over
> "export var=val" myself, but I wonder how unportable this is
> these days.
> 
> Just wondering, no objection.
> 
> Do you have a specific shell in mind that groks other constructs
> used in our tests but not "export var=val" form?

I can't remember, and I can't seem to find one, either.  Even posh
(latest debian unstable) and ash (from woody) seem to support it...

On a related note, how portable is mkdir -p these days?  I remember
seeing systems that don't have it, too.

-- 
Eric Wong

```
