quieting down git-commit (and init-db) in tests
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(-)
Signature · 1 line
Eric Wong
PATCH 1/3 t6024-recursive-merge: quiet down this test
We get an extra measure of error checking here as well. While we're at it, also removed a less portable use of export.
--- t/t6024-recursive-merge.sh | 90 +++++++++++++++++++++++--------------------- 1 files changed, 47 insertions(+), 43 deletions(-)
t/t6024-recursive-merge.sh +47 -43
@@ -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"
Signature · 1 line
1.4.4.3.gd4ada
PATCH 2/3 test-lib: quiet down init-db output for tests
I don't think anybody running tests needs to know they're running init-db and creating a repository for testing.
--- t/test-lib.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
t/test-lib.sh +1 -1
@@ -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"
Signature · 1 line
1.4.4.3.gd4ada
PATCH 3/3 t9200-git-cvsexportcommit.sh: quiet down commit
Also, fixed an unportable use of 'export'.
--- t/t9200-git-cvsexportcommit.sh | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)
t/t9200-git-cvsexportcommit.sh +6 -4
@@ -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 \
Signature · 1 line
1.4.4.3.gd4ada
Re: [PATCH 3/3] t9200-git-cvsexportcommit.sh: quiet down commit
Quoted 1 line · Eric Wong
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?
Re: [PATCH 3/3] t9200-git-cvsexportcommit.sh: quiet down commit
Quoted 4 lines · Junio C Hamano
Quoted 1 line · Eric Wong
Also, fixed an unportable use of 'export'.
Quoted 8 lines
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.
Signature · 1 line
Eric Wong