Skip to content
Snippets Groups Projects
Commit 24d4741674a6 authored by David M. Carr's avatar David M. Carr
Browse files

tests: use fn_git_commit in test-encoding.t

In c4849b2dab87, the "commit" function was extracted into a testutil for re-use.
However, test-encoding.t was skipped over in that changeset, as I was seeing
unexplained test failures.  Since those test failures have now been explained
(and fixed), this changeset performs the same extraction on test-encoding.t as
was done on all the other tests.

The version of fn_git_commit that was used in testutil redirected all output
(including errors) to /dev/null, which didn't match the expectations of this
test.  The test utility functions for commit/tag now no longer throw away error
output, instead leaving it to individual tests to decide if error output should
be ignored.
parent fbbdbc8a8785
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@
GIT_AUTHOR_NAME='tst ncdng'; export GIT_AUTHOR_NAME
echo beta > beta
git add beta
commit -m 'add beta'
fn_git_commit -m 'add beta'
echo gamma > gamma
git add gamma
......@@ -9,9 +9,9 @@
echo gamma > gamma
git add gamma
commit -m 'add gmm'
fn_git_commit -m 'add gmm'
# test the commit encoding field
git config i18n.commitencoding latin-1
echo delta > delta
git add delta
......@@ -13,6 +13,6 @@
# test the commit encoding field
git config i18n.commitencoding latin-1
echo delta > delta
git add delta
commit -m 'add dlt'
fn_git_commit -m 'add dlt'
......@@ -3,22 +3,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"
$ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
$ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
$ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
$ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
$ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
$ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
$ count=10
$ commit()
> {
> GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
> GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
> git commit "$@" >/dev/null || echo "git commit error"
> count=`expr $count + 1`
> }
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
......@@ -26,7 +10,7 @@
utf-8 encoded commit message
$ echo alpha > alpha
$ git add alpha
$ commit -m 'add älphà'
$ fn_git_commit -m 'add älphà'
Create some commits using latin1 encoding
The warning message changed in Git 1.8.0
......
......@@ -33,9 +33,9 @@
fn_git_commit() {
GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
git commit "$@" >/dev/null 2>/dev/null || echo "git commit error"
git commit "$@" >/dev/null || echo "git commit error"
count=`expr $count + 1`
}
fn_hg_commit() {
HGDATE="2007-01-01 00:00:$count +0000"
......@@ -37,12 +37,12 @@
count=`expr $count + 1`
}
fn_hg_commit() {
HGDATE="2007-01-01 00:00:$count +0000"
hg commit -d "$HGDATE" "$@" >/dev/null 2>/dev/null || echo "hg commit error"
hg commit -d "$HGDATE" "$@" >/dev/null || echo "hg commit error"
count=`expr $count + 1`
}
fn_git_tag() {
GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
......@@ -43,12 +43,12 @@
count=`expr $count + 1`
}
fn_git_tag() {
GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
git tag "$@" >/dev/null 2>/dev/null || echo "git tag error"
git tag "$@" >/dev/null || echo "git tag error"
count=`expr $count + 1`
}
fn_hg_tag() {
HGDATE="2007-01-01 00:00:$count +0000"
......@@ -50,8 +50,8 @@
count=`expr $count + 1`
}
fn_hg_tag() {
HGDATE="2007-01-01 00:00:$count +0000"
hg tag -d "$HGDATE" "$@" >/dev/null 2>/dev/null || echo "hg tag error"
hg tag -d "$HGDATE" "$@" >/dev/null || echo "hg tag error"
count=`expr $count + 1`
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment