git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] Add core.autocrlf=true on cygwin by default during tests
@ 2009-05-11 19:28 Don Slutz
  2009-05-11 19:28 ` [PATCH 1/6] " Don Slutz
                   ` (3 more replies)
  0 siblings, 4 replies; 24+ messages in thread
From: Don Slutz @ 2009-05-11 19:28 UTC (permalink / raw)
  To: git; +Cc: Don Slutz

This is a patch set to do the work from mail message:

http://kerneltrap.org/mailarchive/git/2007/8/7/254415

It is split into 6 parts.  This is because the tests do not work on
Linux if autocrlf=true.

1) The change to autocrlf=true by default for cygwin

2) Changes to t/test-lib.sh

3) The simple changes to tests to use the new functions.

4) Force core.autocrlf=false tests

5) The changes that switch from using cmp to using test_cmp.

6) Add 'make test-text' to use these changes

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 1/6] Add core.autocrlf=true on cygwin by default during tests
  2009-05-11 19:28 [PATCH 0/6] Add core.autocrlf=true on cygwin by default during tests Don Slutz
@ 2009-05-11 19:28 ` Don Slutz
  2009-05-11 19:28   ` [PATCH 2/6] Fix tests to work with core.autocrlf=true Don Slutz
  2009-05-11 20:04 ` [PATCH 0/6] Add core.autocrlf=true on cygwin by default during tests Eric Blake
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 24+ messages in thread
From: Don Slutz @ 2009-05-11 19:28 UTC (permalink / raw)
  To: git; +Cc: Don Slutz

It can be disabled or enabled by using the GIT_TEST_AUTO_CRLF environment
variable.

Signed-off-by: Don Slutz <Don.Slutz@SierraAtlantic.com>
---
 t/test-lib.sh |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index dad1437..218bd82 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -119,6 +119,17 @@ do
 	esac
 done
 
+# Switch to core.autolf = true on cygwin but only by default
+case $(uname -s) in
+*CYGWIN*)
+	GIT_TEST_AUTO_CRLF=${GIT_TEST_AUTO_CRLF:-true}
+	test "$debug" = "" ||
+	echo "Test in mode" $(cygpath --mode . | cut -d: -f2-) "mount"
+	;;
+*)
+	;;
+esac
+
 if test -n "$color"; then
 	say_color () {
 		(
@@ -493,6 +504,11 @@ test_create_repo () {
 	cd "$repo" || error "Cannot setup test environment"
 	"$GIT_EXEC_PATH/git-init" "--template=$TEST_DIRECTORY/../templates/blt/" >&3 2>&4 ||
 	error "cannot run git init -- have you built things yet?"
+	test ! -z "$GIT_TEST_AUTO_CRLF" &&
+	test_debug "echo Switching to autocrlf=$GIT_TEST_AUTO_CRLF" && {
+		git config core.autocrlf $GIT_TEST_AUTO_CRLF ||
+		error "Failed to switch to autocrlf=$GIT_TEST_AUTO_CRLF"
+	}
 	mv .git/hooks .git/hooks-disabled
 	cd "$owd"
 }
-- 
1.6.3.15.g49878

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 2/6] Fix tests to work with core.autocrlf=true
  2009-05-11 19:28 ` [PATCH 1/6] " Don Slutz
@ 2009-05-11 19:28   ` Don Slutz
  2009-05-11 19:28     ` [PATCH 3/6] " Don Slutz
  0 siblings, 1 reply; 24+ messages in thread
From: Don Slutz @ 2009-05-11 19:28 UTC (permalink / raw)
  To: git; +Cc: Don Slutz

test-lib changes.

Run the tests via:

  GIT_TEST_AUTO_CRLF=true make test

Change the default value of GIT_TEST_CMP to ignore whitespace changes
when core.autocrlf=true

Add support functions: test_external_with_only_warning, test_eq_cat,
test_cat_eq, and test_ne_cat all of which will ignore CR if it is in
the file.

Signed-off-by: Don Slutz <Don.Slutz@SierraAtlantic.com>
---
 t/test-lib.sh |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 58 insertions(+), 1 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 218bd82..84846cd 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -59,7 +59,6 @@ export GIT_MERGE_VERBOSITY
 export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
 export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
 export EDITOR VISUAL
-GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}
 
 # Protect ourselves from common misconfiguration to export
 # CDPATH into the environment
@@ -129,6 +128,11 @@ case $(uname -s) in
 *)
 	;;
 esac
+if test ! -z $GIT_TEST_AUTO_CRLF && test $GIT_TEST_AUTO_CRLF = true; then
+	GIT_TEST_CMP=${GIT_TEST_CMP:-diff -uw}
+else
+	GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}
+fi
 
 if test -n "$color"; then
 	say_color () {
@@ -459,6 +463,35 @@ test_external_without_stderr () {
 	fi
 }
 
+# Like test_external, but in addition tests that the command generated
+# only "warning: LF will be replaced by CRLF" output on stderr.
+test_external_with_only_warning () {
+	# The temporary file has no (and must have no) security
+	# implications.
+	tmp="$TMPDIR"; if [ -z "$tmp" ]; then tmp=/tmp; fi
+	stderr="$tmp/git-external-stderr.$$.tmp"
+	test_external "$@" 4> "$stderr"
+	[ -f "$stderr" ] || error "Internal error: $stderr disappeared."
+	descr="only warning: $1"
+	shift
+	say >&3 "expecting only warnings from previous command"
+	output=$(grep -v "warning: LF will be replaced by CRLF in" $stderr)
+	test_debug "echo non-warning: $output"
+	if [ -z "$output" ]; then
+		rm "$stderr"
+		test_ok_ "$descr"
+	else
+		if [ "$verbose" = t ]; then
+			output=`echo; echo Stderr is:; cat "$stderr"`
+		else
+			output=
+		fi
+		# rm first in case test_failure exits.
+		rm "$stderr"
+		test_failure_ "$descr" "$@" "$output"
+	fi
+}
+
 # This is not among top-level (test_expect_success | test_expect_failure)
 # but is a prefix that can be used in the test script, like:
 #
@@ -493,6 +526,30 @@ test_cmp() {
 	$GIT_TEST_CMP "$@"
 }
 
+# test_eq_cat is a helper function to compare a 1 word file
+# with a string.
+# It almost the same as: test foo = $(cat bar)
+# for: test_eq_cat foo bar
+#
+# However it works when core.autocrlf = true.
+
+test_eq_cat() {
+	test "$1" = "$(tr '\015' '\012' < "$2")"
+}
+
+# the but not-equal -- may not catch all cases
+
+test_ne_cat() {
+	test "$1" != "$(tr '\015' '\012' < "$2")"
+}
+
+# the same as test_eq_cat, but file is 1st.
+
+test_cat_eq() {
+	test "$(tr '\015' '\012' < "$1")" = "$2"
+}
+
+
 # Most tests can use the created repository, but some may need to create more.
 # Usage: test_create_repo <directory>
 test_create_repo () {
-- 
1.6.3.15.g49878

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 3/6] Fix tests to work with core.autocrlf=true
  2009-05-11 19:28   ` [PATCH 2/6] Fix tests to work with core.autocrlf=true Don Slutz
@ 2009-05-11 19:28     ` Don Slutz
  2009-05-11 19:28       ` [PATCH 4/6] " Don Slutz
  2009-05-11 22:20       ` [PATCH 3/6] Fix tests to work with core.autocrlf=true Charles Bailey
  0 siblings, 2 replies; 24+ messages in thread
From: Don Slutz @ 2009-05-11 19:28 UTC (permalink / raw)
  To: git; +Cc: Don Slutz

Use the new functions to fix tests.

Signed-off-by: Don Slutz <Don.Slutz@SierraAtlantic.com>
---
 t/t0002-gitfile.sh                        |    3 +-
 t/t2004-checkout-cache-temp.sh            |   42 ++++++++++++++--------------
 t/t2008-checkout-subdir.sh                |   14 +++++-----
 t/t3404-rebase-interactive.sh             |    2 +-
 t/t3410-rebase-preserve-dropped-merges.sh |   12 ++++----
 t/t3413-rebase-hook.sh                    |   32 +++++++++++-----------
 t/t3503-cherry-pick-root.sh               |    2 +-
 t/t3903-stash.sh                          |   12 ++++----
 t/t4102-apply-rename.sh                   |    5 ++-
 t/t4124-apply-ws-rule.sh                  |   23 ++++++++++++---
 t/t4125-apply-ws-fuzz.sh                  |    9 +++++-
 t/t4128-apply-root.sh                     |    8 +++---
 t/t4150-am.sh                             |    4 +-
 t/t4252-am-options.sh                     |   16 ++++++++---
 t/t5000-tar-tree.sh                       |   12 +++++---
 t/t5001-archive-attr.sh                   |    3 ++
 t/t5520-pull.sh                           |   12 ++++----
 t/t7003-filter-branch.sh                  |    4 +-
 t/t7201-co.sh                             |    2 +-
 t/t7402-submodule-rebase.sh               |    4 +-
 t/t7610-mergetool.sh                      |    6 ++--
 t/t7800-difftool.sh                       |   13 +++++----
 t/t9700-perl-git.sh                       |    2 +-
 23 files changed, 139 insertions(+), 103 deletions(-)

diff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh
index cb14425..3762714 100755
--- a/t/t0002-gitfile.sh
+++ b/t/t0002-gitfile.sh
@@ -60,7 +60,8 @@ test_expect_success 'final setup + check rev-parse --git-dir' '
 
 test_expect_success 'check hash-object' '
 	echo "foo" >bar &&
-	SHA=$(cat bar | git hash-object -w --stdin) &&
+	SHA=$(cat bar | git hash-object -w --stdin --path=bar) &&
+	test_debug "echo SHA=$SHA" &&
 	objck $SHA
 '
 
diff --git a/t/t2004-checkout-cache-temp.sh b/t/t2004-checkout-cache-temp.sh
index 36cca14..ce4c584 100755
--- a/t/t2004-checkout-cache-temp.sh
+++ b/t/t2004-checkout-cache-temp.sh
@@ -44,7 +44,7 @@ test $(wc -l <out) = 1 &&
 test $(cut "-d	" -f2 out) = path1 &&
 p=$(cut "-d	" -f1 out) &&
 test -f $p &&
-test $(cat $p) = tree1path1'
+test_cat_eq $p tree1path1'
 
 test_expect_success \
 'checkout all stage 0 to temporary files' '
@@ -57,7 +57,7 @@ do
 	test $(grep $f out | cut "-d	" -f2) = $f &&
 	p=$(grep $f out | cut "-d	" -f1) &&
 	test -f $p &&
-	test $(cat $p) = tree1$f
+	test_cat_eq $p tree1$f
 done'
 
 test_expect_success \
@@ -73,7 +73,7 @@ test $(wc -l <out) = 1 &&
 test $(cut "-d	" -f2 out) = path1 &&
 p=$(cut "-d	" -f1 out) &&
 test -f $p &&
-test $(cat $p) = tree2path1'
+test_cat_eq $p tree2path1'
 
 test_expect_success \
 'checkout all stage 2 to temporary files' '
@@ -85,7 +85,7 @@ do
 	test $(grep $f out | cut "-d	" -f2) = $f &&
 	p=$(grep $f out | cut "-d	" -f1) &&
 	test -f $p &&
-	test $(cat $p) = tree2$f
+	test_cat_eq $p tree2$f
 done'
 
 test_expect_success \
@@ -104,9 +104,9 @@ cut "-d	" -f1 out | (read s1 s2 s3 &&
 test -f $s1 &&
 test -f $s2 &&
 test -f $s3 &&
-test $(cat $s1) = tree1path1 &&
-test $(cat $s2) = tree2path1 &&
-test $(cat $s3) = tree3path1)'
+test_cat_eq $s1 tree1path1 &&
+test_cat_eq $s2 tree2path1 &&
+test_cat_eq $s3 tree3path1)'
 
 test_expect_success \
 'checkout some stages/one file to temporary files' '
@@ -118,8 +118,8 @@ cut "-d	" -f1 out | (read s1 s2 s3 &&
 test $s1 = . &&
 test -f $s2 &&
 test -f $s3 &&
-test $(cat $s2) = tree2path2 &&
-test $(cat $s3) = tree3path2)'
+test_cat_eq $s2 tree2path2 &&
+test_cat_eq $s3 tree3path2)'
 
 test_expect_success \
 'checkout all stages/all files to temporary files' '
@@ -138,9 +138,9 @@ grep path1 out | cut "-d	" -f1 | (read s1 s2 s3 &&
 test -f $s1 &&
 test -f $s2 &&
 test -f $s3 &&
-test $(cat $s1) = tree1path1 &&
-test $(cat $s2) = tree2path1 &&
-test $(cat $s3) = tree3path1)'
+test_cat_eq $s1 tree1path1 &&
+test_cat_eq $s2 tree2path1 &&
+test_cat_eq $s3 tree3path1)'
 
 test_expect_success \
 '-- path2: no stage 1, have stage 2 and 3' '
@@ -149,8 +149,8 @@ grep path2 out | cut "-d	" -f1 | (read s1 s2 s3 &&
 test $s1 = . &&
 test -f $s2 &&
 test -f $s3 &&
-test $(cat $s2) = tree2path2 &&
-test $(cat $s3) = tree3path2)'
+test_cat_eq $s2 tree2path2 &&
+test_cat_eq $s3 tree3path2)'
 
 test_expect_success \
 '-- path3: no stage 2, have stage 1 and 3' '
@@ -159,8 +159,8 @@ grep path3 out | cut "-d	" -f1 | (read s1 s2 s3 &&
 test -f $s1 &&
 test $s2 = . &&
 test -f $s3 &&
-test $(cat $s1) = tree1path3 &&
-test $(cat $s3) = tree3path3)'
+test_cat_eq $s1 tree1path3 &&
+test_cat_eq $s3 tree3path3)'
 
 test_expect_success \
 '-- path4: no stage 3, have stage 1 and 3' '
@@ -169,8 +169,8 @@ grep path4 out | cut "-d	" -f1 | (read s1 s2 s3 &&
 test -f $s1 &&
 test -f $s2 &&
 test $s3 = . &&
-test $(cat $s1) = tree1path4 &&
-test $(cat $s2) = tree2path4)'
+test_cat_eq $s1 tree1path4 &&
+test_cat_eq $s2 tree2path4)'
 
 test_expect_success \
 '-- asubdir/path5: no stage 2 and 3 have stage 1' '
@@ -179,7 +179,7 @@ grep asubdir/path5 out | cut "-d	" -f1 | (read s1 s2 s3 &&
 test -f $s1 &&
 test $s2 = . &&
 test $s3 = . &&
-test $(cat $s1) = tree1asubdir/path5)'
+test_cat_eq $s1 tree1asubdir/path5)'
 
 test_expect_success \
 'checkout --temp within subdir' '
@@ -191,7 +191,7 @@ test_expect_success \
  test -f ../$s1 &&
  test $s2 = . &&
  test $s3 = . &&
- test $(cat ../$s1) = tree1asubdir/path5)
+ test_cat_eq ../$s1 tree1asubdir/path5)
 )'
 
 test_expect_success SYMLINKS \
@@ -207,6 +207,6 @@ test $(wc -l <out) = 1 &&
 test $(cut "-d	" -f2 out) = a &&
 p=$(cut "-d	" -f1 out) &&
 test -f $p &&
-test $(cat $p) = b'
+test_cat_eq $p b'
 
 test_done
diff --git a/t/t2008-checkout-subdir.sh b/t/t2008-checkout-subdir.sh
index 3e098ab..7933197 100755
--- a/t/t2008-checkout-subdir.sh
+++ b/t/t2008-checkout-subdir.sh
@@ -27,14 +27,14 @@ test_expect_success 'remove and restore with relative path' '
 		cd dir1 &&
 		rm ../file0 &&
 		git checkout HEAD -- ../file0 &&
-		test "base" = "$(cat ../file0)" &&
+		test_eq_cat base ../file0 &&
 		rm ../dir2/file2 &&
 		git checkout HEAD -- ../dir2/file2 &&
-		test "bonjour" = "$(cat ../dir2/file2)" &&
+		test_eq_cat bonjour ../dir2/file2 &&
 		rm ../file0 ./file1 &&
 		git checkout HEAD -- .. &&
-		test "base" = "$(cat ../file0)" &&
-		test "hello" = "$(cat file1)"
+		test_eq_cat base ../file0 &&
+		test_eq_cat hello file1
 	)
 
 '
@@ -43,7 +43,7 @@ test_expect_success 'checkout with empty prefix' '
 
 	rm file0 &&
 	git checkout HEAD -- file0 &&
-	test "base" = "$(cat file0)"
+	test_eq_cat base file0
 
 '
 
@@ -51,10 +51,10 @@ test_expect_success 'checkout with simple prefix' '
 
 	rm dir1/file1 &&
 	git checkout HEAD -- dir1 &&
-	test "hello" = "$(cat dir1/file1)" &&
+	test_eq_cat hello dir1/file1 &&
 	rm dir1/file1 &&
 	git checkout HEAD -- dir1/file1 &&
-	test "hello" = "$(cat dir1/file1)"
+	test_eq_cat hello dir1/file1
 
 '
 
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index c32ff66..6990c77 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -162,7 +162,7 @@ test_expect_success 'squash' '
 	GIT_AUTHOR_NAME="Nitfol" git commit -m "nitfol" file7 &&
 	echo "******************************" &&
 	FAKE_LINES="1 squash 2" git rebase -i --onto master HEAD~2 &&
-	test B = $(cat file7) &&
+	test_eq_cat B file7 &&
 	test $(git rev-parse HEAD^) = $(git rev-parse master)
 '
 
diff --git a/t/t3410-rebase-preserve-dropped-merges.sh b/t/t3410-rebase-preserve-dropped-merges.sh
index c49143a..a044962 100755
--- a/t/t3410-rebase-preserve-dropped-merges.sh
+++ b/t/t3410-rebase-preserve-dropped-merges.sh
@@ -52,9 +52,9 @@ test_expect_success 'skip same-resolution merges with -p' '
 	test_commit K file7 file7 &&
 	git rebase -i -p L &&
 	test $(git rev-parse HEAD^^) = $(git rev-parse L) &&
-	test "23" = "$(cat file1)" &&
-	test "I" = "$(cat file6)" &&
-	test "file7" = "$(cat file7)"
+	test_eq_cat 23 file1 &&
+	test_eq_cat I file6 &&
+	test_eq_cat file7 file7
 '
 
 # A - B - C - D - E
@@ -77,9 +77,9 @@ test_expect_success 'keep different-resolution merges with -p' '
 	git add file1 &&
 	git rebase --continue &&
 	test $(git rev-parse HEAD^^^) = $(git rev-parse L2) &&
-	test "234" = "$(cat file1)" &&
-	test "I" = "$(cat file6)" &&
-	test "file7" = "$(cat file7)"
+	test_eq_cat 234 file1 &&
+	test_eq_cat I file6 &&
+	test_eq_cat file7 file7
 '
 
 test_done
diff --git a/t/t3413-rebase-hook.sh b/t/t3413-rebase-hook.sh
index 098b755..ac9ad05 100755
--- a/t/t3413-rebase-hook.sh
+++ b/t/t3413-rebase-hook.sh
@@ -27,14 +27,14 @@ test_expect_success 'rebase' '
 	git checkout test &&
 	git reset --hard side &&
 	git rebase master &&
-	test "z$(cat git)" = zworld
+	test_cat_eq git world
 '
 
 test_expect_success 'rebase -i' '
 	git checkout test &&
 	git reset --hard side &&
 	EDITOR=true git rebase -i master &&
-	test "z$(cat git)" = zworld
+	test_cat_eq git world
 '
 
 test_expect_success 'setup pre-rebase hook' '
@@ -50,8 +50,8 @@ test_expect_success 'pre-rebase hook gets correct input (1)' '
 	git checkout test &&
 	git reset --hard side &&
 	git rebase master &&
-	test "z$(cat git)" = zworld &&
-	test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,
+	test_cat_eq git world &&
+	test_cat_eq .git/PRE-REBASE-INPUT master,
 
 '
 
@@ -59,8 +59,8 @@ test_expect_success 'pre-rebase hook gets correct input (2)' '
 	git checkout test &&
 	git reset --hard side &&
 	git rebase master test &&
-	test "z$(cat git)" = zworld &&
-	test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,test
+	test_cat_eq git world &&
+	test_cat_eq .git/PRE-REBASE-INPUT master,test
 '
 
 test_expect_success 'pre-rebase hook gets correct input (3)' '
@@ -68,16 +68,16 @@ test_expect_success 'pre-rebase hook gets correct input (3)' '
 	git reset --hard side &&
 	git checkout master &&
 	git rebase master test &&
-	test "z$(cat git)" = zworld &&
-	test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,test
+	test_cat_eq git world &&
+	test_cat_eq .git/PRE-REBASE-INPUT master,test
 '
 
 test_expect_success 'pre-rebase hook gets correct input (4)' '
 	git checkout test &&
 	git reset --hard side &&
 	EDITOR=true git rebase -i master &&
-	test "z$(cat git)" = zworld &&
-	test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,
+	test_cat_eq git world &&
+	test_cat_eq .git/PRE-REBASE-INPUT master,
 
 '
 
@@ -85,8 +85,8 @@ test_expect_success 'pre-rebase hook gets correct input (5)' '
 	git checkout test &&
 	git reset --hard side &&
 	EDITOR=true git rebase -i master test &&
-	test "z$(cat git)" = zworld &&
-	test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,test
+	test_cat_eq git world &&
+	test_cat_eq .git/PRE-REBASE-INPUT master,test
 '
 
 test_expect_success 'pre-rebase hook gets correct input (6)' '
@@ -94,8 +94,8 @@ test_expect_success 'pre-rebase hook gets correct input (6)' '
 	git reset --hard side &&
 	git checkout master &&
 	EDITOR=true git rebase -i master test &&
-	test "z$(cat git)" = zworld &&
-	test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,test
+	test_cat_eq git world &&
+	test_cat_eq .git/PRE-REBASE-INPUT master,test
 '
 
 test_expect_success 'setup pre-rebase hook that fails' '
@@ -132,7 +132,7 @@ test_expect_success 'rebase --no-verify overrides pre-rebase (1)' '
 	git reset --hard side &&
 	git rebase --no-verify master &&
 	test "z$(git symbolic-ref HEAD)" = zrefs/heads/test &&
-	test "z$(cat git)" = zworld
+	test_cat_eq git world
 '
 
 test_expect_success 'rebase --no-verify overrides pre-rebase (2)' '
@@ -140,7 +140,7 @@ test_expect_success 'rebase --no-verify overrides pre-rebase (2)' '
 	git reset --hard side &&
 	EDITOR=true git rebase --no-verify -i master &&
 	test "z$(git symbolic-ref HEAD)" = zrefs/heads/test &&
-	test "z$(cat git)" = zworld
+	test_cat_eq git world
 '
 
 test_done
diff --git a/t/t3503-cherry-pick-root.sh b/t/t3503-cherry-pick-root.sh
index b0faa29..dfcd72a 100755
--- a/t/t3503-cherry-pick-root.sh
+++ b/t/t3503-cherry-pick-root.sh
@@ -23,7 +23,7 @@ test_expect_success setup '
 test_expect_success 'cherry-pick a root commit' '
 
 	git cherry-pick master &&
-	test first = $(cat file1)
+	test_eq_cat first file1
 
 '
 
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 7484cbe..7c1e169 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -49,7 +49,7 @@ test_expect_success 'apply stashed changes' '
 	test_tick &&
 	git commit -m other-file &&
 	git stash apply &&
-	test 3 = $(cat file) &&
+	test_eq_cat 3 file &&
 	test 1 = $(git show :file) &&
 	test 1 = $(git show HEAD:file)
 '
@@ -61,7 +61,7 @@ test_expect_success 'apply stashed changes (including index)' '
 	test_tick &&
 	git commit -m other-file &&
 	git stash apply --index &&
-	test 3 = $(cat file) &&
+	test_eq_cat 3 file &&
 	test 2 = $(git show :file) &&
 	test 1 = $(git show HEAD:file)
 '
@@ -83,7 +83,7 @@ test_expect_success 'drop top stash' '
 	git stash list > stashlist2 &&
 	diff stashlist1 stashlist2 &&
 	git stash apply &&
-	test 3 = $(cat file) &&
+	test_eq_cat 3 file &&
 	test 1 = $(git show :file) &&
 	test 1 = $(git show HEAD:file)
 '
@@ -97,13 +97,13 @@ test_expect_success 'drop middle stash' '
 	git stash drop stash@{1} &&
 	test 2 = $(git stash list | wc -l) &&
 	git stash apply &&
-	test 9 = $(cat file) &&
+	test_eq_cat 9 file &&
 	test 1 = $(git show :file) &&
 	test 1 = $(git show HEAD:file) &&
 	git reset --hard &&
 	git stash drop &&
 	git stash apply &&
-	test 3 = $(cat file) &&
+	test_eq_cat 3 file &&
 	test 1 = $(git show :file) &&
 	test 1 = $(git show HEAD:file)
 '
@@ -111,7 +111,7 @@ test_expect_success 'drop middle stash' '
 test_expect_success 'stash pop' '
 	git reset --hard &&
 	git stash pop &&
-	test 3 = $(cat file) &&
+	test_eq_cat 3 file &&
 	test 1 = $(git show :file) &&
 	test 1 = $(git show HEAD:file) &&
 	test 0 = $(git stash list | wc -l)
diff --git a/t/t4102-apply-rename.sh b/t/t4102-apply-rename.sh
index 1597965..5c7300d 100755
--- a/t/t4102-apply-rename.sh
+++ b/t/t4102-apply-rename.sh
@@ -43,7 +43,7 @@ test_expect_success FILEMODE validate \
 
 test_expect_success 'apply reverse' \
     'git apply -R --index --stat --summary --apply test-patch &&
-     test "$(cat foo)" = "This is foo"'
+     test_cat_eq foo "This is foo"'
 
 cat >test-patch <<\EOF
 diff --git a/foo b/bar
@@ -59,6 +59,7 @@ EOF
 
 test_expect_success 'apply copy' \
     'git apply --index --stat --summary --apply test-patch &&
-     test "$(cat bar)" = "This is bar" -a "$(cat foo)" = "This is foo"'
+     test_cat_eq bar "This is bar" &&
+     test_cat_eq foo "This is foo"'
 
 test_done
diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh
index f83322e..3933dd9 100755
--- a/t/t4124-apply-ws-rule.sh
+++ b/t/t4124-apply-ws-rule.sh
@@ -38,13 +38,19 @@ apply_patch () {
 	git apply "$@"
 }
 
+remove_cr () {
+	tr '\015' Q <"$1" | sed -e 's/Q$//'
+}
+
 test_fix () {
 
 	# fix should not barf
 	apply_patch --whitespace=fix || return 1
 
+	test_debug "echo patch applied: [$1]"
 	# find touched lines
-	diff file target | sed -n -e "s/^> //p" >fixed
+	remove_cr target >target1
+	diff file target1 | sed -n -e "s/^> //p" >fixed
 
 	# the changed lines are all expeced to change
 	fixed_cnt=$(wc -l <fixed)
@@ -52,6 +58,7 @@ test_fix () {
 	'') expect_cnt=$fixed_cnt ;;
 	?*) expect_cnt=$(grep "[$1]" <fixed | wc -l) ;;
 	esac
+	test_debug "echo fixed: $fixed_cnt vs $expect_cnt"
 	test $fixed_cnt -eq $expect_cnt || return 1
 
 	# and we are not missing anything
@@ -59,12 +66,14 @@ test_fix () {
 	'') expect_cnt=0 ;;
 	?*) expect_cnt=$(grep "[$1]" <file | wc -l) ;;
 	esac
+	test_debug "echo missing: $fixed_cnt vs $expect_cnt"
 	test $fixed_cnt -eq $expect_cnt || return 1
 
 	# Get the patch actually applied
 	git diff-files -p target >fixed-patch
 	test -s fixed-patch && return 0
 
+	test_debug "echo failed to apply, try and fix"
 	# Make sure it is complaint-free
 	>target
 	git apply --whitespace=error-all <fixed-patch
@@ -85,14 +94,16 @@ test_expect_success setup '
 test_expect_success 'whitespace=nowarn, default rule' '
 
 	apply_patch --whitespace=nowarn &&
-	diff file target
+	remove_cr target >target1 &&
+	diff file target1
 
 '
 
 test_expect_success 'whitespace=warn, default rule' '
 
 	apply_patch --whitespace=warn &&
-	diff file target
+	remove_cr target >target1 &&
+	diff file target1
 
 '
 
@@ -108,7 +119,8 @@ test_expect_success 'whitespace=error-all, no rule' '
 
 	git config core.whitespace -trailing,-space-before,-indent &&
 	apply_patch --whitespace=error-all &&
-	diff file target
+	remove_cr target >target1 &&
+	diff file target1
 
 '
 
@@ -117,7 +129,8 @@ test_expect_success 'whitespace=error-all, no rule (attribute)' '
 	git config --unset core.whitespace &&
 	echo "target -whitespace" >.gitattributes &&
 	apply_patch --whitespace=error-all &&
-	diff file target
+	remove_cr target >target1 &&
+	diff file target1
 
 '
 
diff --git a/t/t4125-apply-ws-fuzz.sh b/t/t4125-apply-ws-fuzz.sh
index 3b471b6..c02fe08 100755
--- a/t/t4125-apply-ws-fuzz.sh
+++ b/t/t4125-apply-ws-fuzz.sh
@@ -4,6 +4,10 @@ test_description='applying patch that has broken whitespaces in context'
 
 . ./test-lib.sh
 
+remove_cr () {
+	tr '\015' Q <"$1" | sed -e 's/Q$//'
+}
+
 test_expect_success setup '
 
 	>file &&
@@ -91,12 +95,13 @@ test_expect_success 'withfix (backward)' '
 
 	sed -e /h/d file-fixed >fixed-head &&
 	sed -e /h/d file >file-head &&
-	test_cmp fixed-head file-head &&
+	remove_cr file-head >file-head1
+	diff fixed-head file-head1 &&
 
 	sed -n -e /h/p file-fixed >fixed-tail &&
 	sed -n -e /h/p file >file-tail &&
 
-	! test_cmp fixed-tail file-tail
+	! diff fixed-tail file-tail
 
 '
 
diff --git a/t/t4128-apply-root.sh b/t/t4128-apply-root.sh
index 8f6aea4..a03a9c8 100755
--- a/t/t4128-apply-root.sh
+++ b/t/t4128-apply-root.sh
@@ -27,7 +27,7 @@ test_expect_success 'apply --directory -p (1)' '
 
 	git apply --directory=some/sub -p3 --index patch &&
 	test Bello = $(git show :some/sub/dir/file) &&
-	test Bello = $(cat some/sub/dir/file)
+	test_eq_cat Bello some/sub/dir/file
 
 '
 
@@ -36,7 +36,7 @@ test_expect_success 'apply --directory -p (2) ' '
 	git reset --hard initial &&
 	git apply --directory=some/sub/ -p3 --index patch &&
 	test Bello = $(git show :some/sub/dir/file) &&
-	test Bello = $(cat some/sub/dir/file)
+	test_eq_cat Bello some/sub/dir/file
 
 '
 
@@ -54,7 +54,7 @@ test_expect_success 'apply --directory (new file)' '
 	git reset --hard initial &&
 	git apply --directory=some/sub/dir/ --index patch &&
 	test content = $(git show :some/sub/dir/newfile) &&
-	test content = $(cat some/sub/dir/newfile)
+	test_eq_cat content some/sub/dir/newfile
 '
 
 cat > patch << EOF
@@ -89,7 +89,7 @@ test_expect_success 'apply --directory (quoted filename)' '
 	git reset --hard initial &&
 	git apply --directory=some/sub/dir/ --index patch &&
 	test content = $(git show :some/sub/dir/quotefile) &&
-	test content = $(cat some/sub/dir/quotefile)
+	test_eq_cat content some/sub/dir/quotefile
 '
 
 test_done
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index d6ebbae..27570b7 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -190,7 +190,7 @@ test_expect_success 'am --skip works' '
 	git am --skip &&
 	! test -d .git/rebase-apply &&
 	test -z "$(git diff lorem2^^ -- file)" &&
-	test goodbye = "$(cat another)"
+	test_eq_cat goodbye another
 '
 
 test_expect_success 'am --resolved works' '
@@ -201,7 +201,7 @@ test_expect_success 'am --resolved works' '
 	git add file &&
 	git am --resolved &&
 	! test -d .git/rebase-apply &&
-	test goodbye = "$(cat another)"
+	test_eq_cat goodbye another
 '
 
 test_expect_success 'am takes patches from a Pine mailbox' '
diff --git a/t/t4252-am-options.sh b/t/t4252-am-options.sh
index f603c1b..342fc1a 100755
--- a/t/t4252-am-options.sh
+++ b/t/t4252-am-options.sh
@@ -3,6 +3,10 @@
 test_description='git am with options and not losing them'
 . ./test-lib.sh
 
+remove_cr () {
+	tr '\015' Q <"$1" | sed -e 's/Q$//'
+}
+
 tm="$TEST_DIRECTORY/t4252"
 
 test_expect_success setup '
@@ -20,7 +24,8 @@ test_expect_success 'interrupted am --whitespace=fix' '
 	test_must_fail git am --whitespace=fix "$tm"/am-test-1-? &&
 	git am --skip &&
 	grep 3 file-1 &&
-	grep "^Six$" file-2
+	remove_cr file-2 >file-2a &&
+	grep "^Six$" file-2a
 '
 
 test_expect_success 'interrupted am -C1' '
@@ -29,7 +34,8 @@ test_expect_success 'interrupted am -C1' '
 	test_must_fail git am -C1 "$tm"/am-test-2-? &&
 	git am --skip &&
 	grep 3 file-1 &&
-	grep "^Three$" file-2
+	remove_cr file-2 >file-2a &&
+	grep "^Three$" file-2a
 '
 
 test_expect_success 'interrupted am -p2' '
@@ -38,7 +44,8 @@ test_expect_success 'interrupted am -p2' '
 	test_must_fail git am -p2 "$tm"/am-test-3-? &&
 	git am --skip &&
 	grep 3 file-1 &&
-	grep "^Three$" file-2
+	remove_cr file-2 >file-2a &&
+	grep "^Three$" file-2a
 '
 
 test_expect_success 'interrupted am -C1 -p2' '
@@ -47,7 +54,8 @@ test_expect_success 'interrupted am -C1 -p2' '
 	test_must_fail git am -p2 -C1 "$tm"/am-test-4-? &&
 	git am --skip &&
 	grep 3 file-1 &&
-	grep "^Three$" file-2
+	remove_cr file-2 >file-2a &&
+	grep "^Three$" file-2a
 '
 
 test_expect_success 'interrupted am --directory="frotz nitfol"' '
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index abb41b0..28d6291 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -25,6 +25,8 @@ commit id embedding:
 '
 
 . ./test-lib.sh
+autocrlf=$(git config core.autocrlf)
+
 UNZIP=${UNZIP:-unzip}
 
 SUBSTFORMAT=%H%n
@@ -66,6 +68,8 @@ test_expect_success \
     'git clone --bare . bare.git &&
      cp .git/info/attributes bare.git/info/attributes'
 
+test ! -z "$autocrlf" && (cd bare.git; git config core.autocrlf $autocrlf)
+
 test_expect_success \
     'remove ignored file' \
     'rm a/ignored'
@@ -118,7 +122,7 @@ test_expect_success \
 
 test_expect_success \
     'validate file contents' \
-    'diff -r a b/a'
+    'diff -rb a b/a'
 
 test_expect_success \
     'git tar-tree with prefix' \
@@ -135,7 +139,7 @@ test_expect_success \
 
 test_expect_success \
     'validate file contents with prefix' \
-    'diff -r a c/prefix/a'
+    'diff -rb a c/prefix/a'
 
 test_expect_success \
     'create archives with substfiles' \
@@ -203,7 +207,7 @@ test_expect_success UNZIP \
 
 test_expect_success UNZIP \
     'validate file contents' \
-    'diff -r a d/a'
+    'diff -rb a d/a'
 
 test_expect_success \
     'git archive --format=zip with prefix' \
@@ -220,7 +224,7 @@ test_expect_success UNZIP \
 
 test_expect_success UNZIP \
     'validate file contents with prefix' \
-    'diff -r a e/prefix/a'
+    'diff -rb a e/prefix/a'
 
 test_expect_success \
     'git archive --list outside of a git repo' \
diff --git a/t/t5001-archive-attr.sh b/t/t5001-archive-attr.sh
index 426b319..2efa018 100755
--- a/t/t5001-archive-attr.sh
+++ b/t/t5001-archive-attr.sh
@@ -3,6 +3,7 @@
 test_description='git archive attribute tests'
 
 . ./test-lib.sh
+autocrlf=$(git config core.autocrlf)
 
 SUBSTFORMAT=%H%n
 
@@ -39,6 +40,8 @@ test_expect_success 'setup' '
 	cp .git/info/attributes bare/info/attributes
 '
 
+test ! -z "$autocrlf" && (cd bare; git config core.autocrlf $autocrlf)
+
 test_expect_success 'git archive' '
 	git archive HEAD >archive.tar &&
 	(mkdir archive && cd archive && "$TAR" xf -) <archive.tar
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index 725771f..4d4e7ac 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -49,9 +49,9 @@ test_expect_success 'test . as a remote' '
 	echo updated >file &&
 	git commit -a -m updated &&
 	git checkout copy &&
-	test `cat file` = file &&
+	test_cat_eq file file &&
 	git pull &&
-	test `cat file` = updated
+	test_cat_eq file updated
 '
 
 test_expect_success 'the default remote . should not break explicit pull' '
@@ -60,9 +60,9 @@ test_expect_success 'the default remote . should not break explicit pull' '
 	git commit -a -m modified &&
 	git checkout copy &&
 	git reset --hard HEAD^ &&
-	test `cat file` = file &&
+	test_cat_eq file file &&
 	git pull . second &&
-	test `cat file` = modified
+	test_cat_eq file modified
 '
 
 test_expect_success '--rebase' '
@@ -99,8 +99,8 @@ test_expect_success '--rebase with rebased upstream' '
 	echo file > file2 &&
 	git commit -m to-rebase file2 &&
 	git pull --rebase me copy &&
-	test "conflicting modification" = "$(cat file)" &&
-	test file = $(cat file2)
+	test_eq_cat "conflicting modification" file &&
+	test_eq_cat file file2
 
 '
 
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index 329c851..c6e9fb5 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -72,7 +72,7 @@ test_expect_success 'test that the file was renamed' '
 	test d = "$(git show HEAD:doh --)" &&
 	! test -f d &&
 	test -f doh &&
-	test d = "$(cat doh)"
+	test_eq_cat d doh
 '
 
 test_expect_success 'rewrite, renaming a specific directory' '
@@ -85,7 +85,7 @@ test_expect_success 'test that the directory was renamed' '
 	test -d diroh &&
 	! test -d diroh/dir &&
 	test -f diroh/d &&
-	test dir/d = "$(cat diroh/d)"
+	test_eq_cat dir/d diroh/d
 '
 
 git tag oldD HEAD~4
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index bdb808a..62f58eb 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -434,7 +434,7 @@ test_expect_success 'checkout unmerged stage' '
 	test_cmp expect filf &&
 	test_cmp expect file &&
 	git checkout --theirs file &&
-	test ztheirside = "z$(cat file)"
+	test_eq_cat theirside file
 '
 
 test_expect_success 'checkout with --merge' '
diff --git a/t/t7402-submodule-rebase.sh b/t/t7402-submodule-rebase.sh
index f919c8d..8e5d747 100755
--- a/t/t7402-submodule-rebase.sh
+++ b/t/t7402-submodule-rebase.sh
@@ -80,11 +80,11 @@ test_expect_success 'stash with a dirty submodule' '
 	echo new > file &&
 	CURRENT=$(cd submodule && git rev-parse HEAD) &&
 	git stash &&
-	test new != $(cat file) &&
+	test_ne_cat new file &&
 	test submodule = $(git diff --name-only) &&
 	test $CURRENT = $(cd submodule && git rev-parse HEAD) &&
 	git stash apply &&
-	test new = $(cat file) &&
+	test_eq_cat new file &&
 	test $CURRENT = $(cd submodule && git rev-parse HEAD)
 
 '
diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh
index e768c3e..bf39e45 100755
--- a/t/t7610-mergetool.sh
+++ b/t/t7610-mergetool.sh
@@ -45,9 +45,9 @@ test_expect_success 'custom mergetool' '
     ( yes "" | git mergetool file1 >/dev/null 2>&1 ) &&
     ( yes "" | git mergetool file2 >/dev/null 2>&1 ) &&
     ( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) &&
-    test "$(cat file1)" = "master updated" &&
-    test "$(cat file2)" = "master new" &&
-    test "$(cat subdir/file3)" = "master new sub" &&
+    test_cat_eq file1 "master updated" &&
+    test_cat_eq file2 "master new" &&
+    test_cat_eq subdir/file3 "master new sub" &&
     git commit -m "branch1 resolved with mergetool"
 '
 
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index ebdccf9..b95069a 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -35,11 +35,12 @@ restore_test_defaults()
 	unset GIT_DIFFTOOL_PROMPT
 	unset GIT_DIFFTOOL_NO_PROMPT
 	git config diff.tool test-tool &&
-	git config difftool.test-tool.cmd 'cat $LOCAL'
+	git config difftool.test-tool.cmd "tr '\015' '\012' <\$LOCAL"
 }
 
 prompt_given()
 {
+	test_debug "echo prompt_given:$1"
 	prompt="$1"
 	test "$prompt" = "Hit return to launch 'test-tool': branch"
 }
@@ -59,7 +60,7 @@ test_expect_success 'setup' '
 # Configure a custom difftool.<tool>.cmd and use it
 test_expect_success 'custom commands' '
 	restore_test_defaults &&
-	git config difftool.test-tool.cmd "cat \$REMOTE" &&
+	git config difftool.test-tool.cmd "tr '\''\015'\'' '\''\012'\'' <\$REMOTE" &&
 
 	diff=$(git difftool --no-prompt branch) &&
 	test "$diff" = "master" &&
@@ -136,7 +137,7 @@ test_expect_success 'GIT_DIFFTOOL_PROMPT variable' '
 	GIT_DIFFTOOL_PROMPT=true &&
 	export GIT_DIFFTOOL_PROMPT &&
 
-	prompt=$(echo | git difftool --prompt branch | tail -1) &&
+	prompt=$(echo | git difftool --prompt branch | head -3 | tail -1) &&
 	prompt_given "$prompt" &&
 
 	restore_test_defaults
@@ -166,7 +167,7 @@ test_expect_success 'difftool.prompt can overridden with -y' '
 test_expect_success 'difftool.prompt can overridden with --prompt' '
 	git config difftool.prompt false &&
 
-	prompt=$(echo | git difftool --prompt branch | tail -1) &&
+	prompt=$(echo | git difftool --prompt branch | head -3 | tail -1) &&
 	prompt_given "$prompt" &&
 
 	restore_test_defaults
@@ -179,7 +180,7 @@ test_expect_success 'difftool last flag wins' '
 
 	restore_test_defaults &&
 
-	prompt=$(echo | git difftool --no-prompt --prompt branch | tail -1) &&
+	prompt=$(echo | git difftool --no-prompt --prompt branch | head -3 | tail -1) &&
 	prompt_given "$prompt" &&
 
 	restore_test_defaults
@@ -190,7 +191,7 @@ test_expect_success 'difftool last flag wins' '
 test_expect_success 'difftool + mergetool config variables' '
 	remove_config_vars
 	git config merge.tool test-tool &&
-	git config mergetool.test-tool.cmd "cat \$LOCAL" &&
+	git config mergetool.test-tool.cmd "tr '\''\015'\'' '\''\012'\'' <\$LOCAL" &&
 
 	diff=$(git difftool --no-prompt branch) &&
 	test "$diff" = "branch" &&
diff --git a/t/t9700-perl-git.sh b/t/t9700-perl-git.sh
index b4ca244..76f741f 100755
--- a/t/t9700-perl-git.sh
+++ b/t/t9700-perl-git.sh
@@ -42,7 +42,7 @@ test_expect_success \
      git config --add test.int 2k
      '
 
-test_external_without_stderr \
+test_external_with_only_warning \
     'Perl API' \
     perl "$TEST_DIRECTORY"/t9700/test.pl
 
-- 
1.6.3.15.g49878

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 4/6] Fix tests to work with core.autocrlf=true
  2009-05-11 19:28     ` [PATCH 3/6] " Don Slutz
@ 2009-05-11 19:28       ` Don Slutz
  2009-05-11 19:29         ` [PATCH 5/6] " Don Slutz
  2009-05-11 22:20       ` [PATCH 3/6] Fix tests to work with core.autocrlf=true Charles Bailey
  1 sibling, 1 reply; 24+ messages in thread
From: Don Slutz @ 2009-05-11 19:28 UTC (permalink / raw)
  To: git; +Cc: Don Slutz

Force core.autocrlf=false for these tests.  Most of these tests are checking
for whitespace differences and so are not simple to fix.  The rest are not
clear how to fix.

Signed-off-by: Don Slutz <Don.Slutz@SierraAtlantic.com>
---
 t/t1002-read-tree-m-u-2way.sh |    3 ++-
 t/t4015-diff-whitespace.sh    |    2 ++
 t/t4019-diff-wserror.sh       |    1 +
 t/t4116-apply-reverse.sh      |    1 +
 t/t4200-rerere.sh             |    2 ++
 5 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh
index 5e40cec..acc9474 100755
--- a/t/t1002-read-tree-m-u-2way.sh
+++ b/t/t1002-read-tree-m-u-2way.sh
@@ -37,7 +37,8 @@ check_cache_at () {
 
 test_expect_success \
     setup \
-    'echo frotz >frotz &&
+    'git config core.autocrlf false &&
+     echo frotz >frotz &&
      echo nitfol >nitfol &&
      echo bozbar >bozbar &&
      echo rezrov >rezrov &&
diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index 6d13da3..122557e 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -9,6 +9,8 @@ test_description='Test special whitespace in diff engine.
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/diff-lib.sh
 
+test_expect_success "setup" 'git config core.autocrlf false'
+
 # Ray Lehtiniemi's example
 
 cat << EOF > x
diff --git a/t/t4019-diff-wserror.sh b/t/t4019-diff-wserror.sh
index 84a1fe3..a580403 100755
--- a/t/t4019-diff-wserror.sh
+++ b/t/t4019-diff-wserror.sh
@@ -6,6 +6,7 @@ test_description='diff whitespace error detection'
 
 test_expect_success setup '
 
+	git config core.autocrlf false &&
 	git config diff.color.whitespace "blue reverse" &&
 	>F &&
 	git add F &&
diff --git a/t/t4116-apply-reverse.sh b/t/t4116-apply-reverse.sh
index 2298ece..a846be6 100755
--- a/t/t4116-apply-reverse.sh
+++ b/t/t4116-apply-reverse.sh
@@ -11,6 +11,7 @@ test_description='git apply in reverse
 
 test_expect_success setup '
 
+	git config core.autocrlf false &&
 	for i in a b c d e f g h i j k l m n; do echo $i; done >file1 &&
 	perl -pe "y/ijk/\\000\\001\\002/" <file1 >file2 &&
 
diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
index a6bc028..5e6cc82 100755
--- a/t/t4200-rerere.sh
+++ b/t/t4200-rerere.sh
@@ -8,6 +8,8 @@ test_description='git rerere
 
 . ./test-lib.sh
 
+git config core.autocrlf false
+
 cat > a1 << EOF
 Some title
 ==========
-- 
1.6.3.15.g49878

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 5/6] Fix tests to work with core.autocrlf=true
  2009-05-11 19:28       ` [PATCH 4/6] " Don Slutz
@ 2009-05-11 19:29         ` Don Slutz
  2009-05-11 19:29           ` [PATCH 6/6] Add 'make test-text' Don Slutz
  0 siblings, 1 reply; 24+ messages in thread
From: Don Slutz @ 2009-05-11 19:29 UTC (permalink / raw)
  To: git; +Cc: Don Slutz

Switch from using cmp to using test_cmp in these tests.

Signed-off-by: Don Slutz <Don.Slutz@SierraAtlantic.com>
---
 t/t0021-conversion.sh        |   12 ++++++------
 t/t1020-subdirectory.sh      |   12 ++++++------
 t/t4127-apply-same-fn.sh     |    2 +-
 t/t6021-merge-criss-cross.sh |    2 +-
 t/t6026-merge-attr.sh        |   10 +++++-----
 5 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index 8fc39d7..7a6d8c7 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -33,17 +33,17 @@ test_expect_success setup '
 	git checkout -- test test.t test.i
 '
 
-script='s/^\$Id: \([0-9a-f]*\) \$/\1/p'
-
 test_expect_success check '
 
-	cmp test.o test &&
-	cmp test.o test.t &&
+	test_cmp test.o test &&
+	test_cmp test.o test.t &&
 
 	# ident should be stripped in the repository
 	git diff --raw --exit-code :test :test.i &&
 	id=$(git rev-parse --verify :test) &&
-	embedded=$(sed -ne "$script" test.i) &&
+	test_debug "echo id=$id"
+	embedded=$(grep Id: test.i | cut -d\  -f2) &&
+	test_debug "echo embedded=$embedded"
 	test "z$id" = "z$embedded" &&
 
 	git cat-file blob :test.t > test.r &&
@@ -85,7 +85,7 @@ test_expect_success expanded_in_repo '
 	rm -f expanded-keywords &&
 	git checkout -- expanded-keywords &&
 	cat expanded-keywords &&
-	cmp expanded-keywords expected-output
+	test_cmp expanded-keywords expected-output
 '
 
 test_done
diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh
index 210e594..ce67e6c 100755
--- a/t/t1020-subdirectory.sh
+++ b/t/t1020-subdirectory.sh
@@ -86,10 +86,10 @@ test_expect_success 'write-tree' '
 test_expect_success 'checkout-index' '
 	cd "$HERE" &&
 	git checkout-index -f -u one &&
-	cmp one original.one &&
+	test_cmp one original.one &&
 	cd dir &&
 	git checkout-index -f -u two &&
-	cmp two ../original.two
+	test_cmp two ../original.two
 '
 
 test_expect_success 'read-tree' '
@@ -97,13 +97,13 @@ test_expect_success 'read-tree' '
 	rm -f one dir/two &&
 	tree=`git write-tree` &&
 	git read-tree --reset -u "$tree" &&
-	cmp one original.one &&
-	cmp dir/two original.two &&
+	test_cmp one original.one &&
+	test_cmp dir/two original.two &&
 	cd dir &&
 	rm -f two &&
 	git read-tree --reset -u "$tree" &&
-	cmp two ../original.two &&
-	cmp ../one ../original.one
+	test_cmp two ../original.two &&
+	test_cmp ../one ../original.one
 '
 
 test_expect_success 'no file/rev ambiguity check inside .git' '
diff --git a/t/t4127-apply-same-fn.sh b/t/t4127-apply-same-fn.sh
index 3a8202e..66b774f 100755
--- a/t/t4127-apply-same-fn.sh
+++ b/t/t4127-apply-same-fn.sh
@@ -27,7 +27,7 @@ test_expect_success 'apply same filename with independent changes' '
 	cp same_fn same_fn2 &&
 	git reset --hard &&
 	git apply patch0 &&
-	diff same_fn same_fn2
+	test_cmp same_fn same_fn2
 '
 
 test_expect_success 'apply same filename with overlapping changes' '
diff --git a/t/t6021-merge-criss-cross.sh b/t/t6021-merge-criss-cross.sh
index 331b9b0..53fdfd8 100755
--- a/t/t6021-merge-criss-cross.sh
+++ b/t/t6021-merge-criss-cross.sh
@@ -87,7 +87,7 @@ cat > file-expect <<EOF
 9
 EOF
 
-test_expect_success 'Criss-cross merge result' 'cmp file file-expect'
+test_expect_success 'Criss-cross merge result' 'test_cmp file file-expect'
 
 test_expect_success 'Criss-cross merge fails (-s resolve)' \
 'git reset --hard A^ &&
diff --git a/t/t6026-merge-attr.sh b/t/t6026-merge-attr.sh
index 1ba0a25..0b57c68 100755
--- a/t/t6026-merge-attr.sh
+++ b/t/t6026-merge-attr.sh
@@ -63,7 +63,7 @@ test_expect_success 'check merge result in working tree' '
 
 	git cat-file -p HEAD:binary >binary-orig &&
 	grep "<<<<<<<" text &&
-	cmp binary-orig binary &&
+	test_cmp binary-orig binary &&
 	! grep "<<<<<<<" union &&
 	grep Master union &&
 	grep Side union
@@ -104,14 +104,14 @@ test_expect_success 'custom merge backend' '
 
 	git merge master &&
 
-	cmp binary union &&
+	test_cmp binary union &&
 	sed -e 1,3d text >check-1 &&
 	o=$(git unpack-file master^:text) &&
 	a=$(git unpack-file side^:text) &&
 	b=$(git unpack-file master:text) &&
 	sh -c "./custom-merge $o $a $b 0" &&
 	sed -e 1,3d $a >check-2 &&
-	cmp check-1 check-2 &&
+	test_cmp check-1 check-2 &&
 	rm -f $o $a $b
 '
 
@@ -131,14 +131,14 @@ test_expect_success 'custom merge backend' '
 		echo "Ok, conflicted"
 	fi &&
 
-	cmp binary union &&
+	test_cmp binary union &&
 	sed -e 1,3d text >check-1 &&
 	o=$(git unpack-file master^:text) &&
 	a=$(git unpack-file anchor:text) &&
 	b=$(git unpack-file master:text) &&
 	sh -c "./custom-merge $o $a $b 0" &&
 	sed -e 1,3d $a >check-2 &&
-	cmp check-1 check-2 &&
+	test_cmp check-1 check-2 &&
 	rm -f $o $a $b
 '
 
-- 
1.6.3.15.g49878

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 6/6] Add 'make test-text'
  2009-05-11 19:29         ` [PATCH 5/6] " Don Slutz
@ 2009-05-11 19:29           ` Don Slutz
  0 siblings, 0 replies; 24+ messages in thread
From: Don Slutz @ 2009-05-11 19:29 UTC (permalink / raw)
  To: git; +Cc: Don Slutz

Signed-off-by: Don Slutz <Don.Slutz@SierraAtlantic.com>
---
 Makefile |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 6e21643..03176a4 100644
--- a/Makefile
+++ b/Makefile
@@ -1482,6 +1482,16 @@ export NO_SVN_TESTS
 test: all
 	$(MAKE) -C t/ all
 
+test-text: all
+ifeq ($(uname_O),Cygwin)
+	@echo Test text mode mount
+	mount -f -u -t $(shell sh -c 'cygpath -m -a t') $(shell sh -c 'cygpath -u -a t')
+	$(MAKE) -C t/ all
+	umount -u $(shell sh -c 'cygpath -u -a t')
+else
+	GIT_TEST_AUTO_CRLF=$${GIT_TEST_AUTO_CRLF:-true} $(MAKE) -C t/ all
+endif
+
 test-ctype$X: ctype.o
 
 test-date$X: date.o ctype.o
-- 
1.6.3.15.g49878

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH 0/6] Add core.autocrlf=true on cygwin by default during tests
  2009-05-11 19:28 [PATCH 0/6] Add core.autocrlf=true on cygwin by default during tests Don Slutz
  2009-05-11 19:28 ` [PATCH 1/6] " Don Slutz
@ 2009-05-11 20:04 ` Eric Blake
  2009-05-12 23:27   ` Junio C Hamano
  2009-05-11 20:54 ` Johannes Schindelin
  2009-05-13 19:35 ` [PATCH v2 0/7] Add GIT_TEST_AUTO_CRLF environment variable to set core.autocrlf on init Don Slutz
  3 siblings, 1 reply; 24+ messages in thread
From: Eric Blake @ 2009-05-11 20:04 UTC (permalink / raw)
  To: git

Don Slutz <Don.Slutz <at> SierraAtlantic.com> writes:

> 
> This is a patch set to do the work from mail message:
> 
> http://kerneltrap.org/mailarchive/git/2007/8/7/254415
> 
> It is split into 6 parts.  This is because the tests do not work on
> Linux if autocrlf=true.
> 
> 1) The change to autocrlf=true by default for cygwin

I help maintain the cygwin packaging of git, and I don't particularly like 
patch 1/6.  Cygwin very much recommends that users stick with binary mounts, 
where cr's are not inserted/stripped by default, and enabling autocrlf in that 
situation is asking for problems (namely, the same set of problems as you would 
have on Linux with autocrlf=true).  While adding an environment variable is 
useful for the case of a user building git on cygwin with the intent of using a 
text-mode mount, it goes against the grain of cygwin's recommendation of not 
using text-mode mounts in the first place.  I would rather see the default 
remain false, even on cygwin, unless the person building git takes steps to 
activate it themselves.

-- 
Eric Blake

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 0/6] Add core.autocrlf=true on cygwin by default during tests
  2009-05-11 19:28 [PATCH 0/6] Add core.autocrlf=true on cygwin by default during tests Don Slutz
  2009-05-11 19:28 ` [PATCH 1/6] " Don Slutz
  2009-05-11 20:04 ` [PATCH 0/6] Add core.autocrlf=true on cygwin by default during tests Eric Blake
@ 2009-05-11 20:54 ` Johannes Schindelin
  2009-05-12 18:16   ` Don Slutz
  2009-05-13 19:35 ` [PATCH v2 0/7] Add GIT_TEST_AUTO_CRLF environment variable to set core.autocrlf on init Don Slutz
  3 siblings, 1 reply; 24+ messages in thread
From: Johannes Schindelin @ 2009-05-11 20:54 UTC (permalink / raw)
  To: Don Slutz; +Cc: git

Hi,

On Mon, 11 May 2009, Don Slutz wrote:

> This is a patch set to do the work from mail message:
> 
> http://kerneltrap.org/mailarchive/git/2007/8/7/254415
> 
> It is split into 6 parts.  This is because the tests do not work on
> Linux if autocrlf=true.
> 
> 1) The change to autocrlf=true by default for cygwin

>From the fallout of our unilateral decision in msysGit to set 
autoCRLF=true all the time, I would advise against this change.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 3/6] Fix tests to work with core.autocrlf=true
  2009-05-11 19:28     ` [PATCH 3/6] " Don Slutz
  2009-05-11 19:28       ` [PATCH 4/6] " Don Slutz
@ 2009-05-11 22:20       ` Charles Bailey
  2009-05-14 13:49         ` Don Slutz
  1 sibling, 1 reply; 24+ messages in thread
From: Charles Bailey @ 2009-05-11 22:20 UTC (permalink / raw)
  To: Don Slutz; +Cc: git

On Mon, May 11, 2009 at 03:28:58PM -0400, Don Slutz wrote:
> diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh
> index e768c3e..bf39e45 100755
> --- a/t/t7610-mergetool.sh
> +++ b/t/t7610-mergetool.sh
> @@ -45,9 +45,9 @@ test_expect_success 'custom mergetool' '
>      ( yes "" | git mergetool file1 >/dev/null 2>&1 ) &&
>      ( yes "" | git mergetool file2 >/dev/null 2>&1 ) &&
>      ( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) &&
> -    test "$(cat file1)" = "master updated" &&
> -    test "$(cat file2)" = "master new" &&
> -    test "$(cat subdir/file3)" = "master new sub" &&
> +    test_cat_eq file1 "master updated" &&
> +    test_cat_eq file2 "master new" &&
> +    test_cat_eq subdir/file3 "master new sub" &&
>      git commit -m "branch1 resolved with mergetool"
>  '

This change concerns me. At the moment, the mergetool test assumes
that globally autocrlf is true and has further tests that attempt to
verify its behaviour with autocrlf set to true. See the very next
test:

test_expect_success 'mergetool crlf' '
    git config core.autocrlf true &&
    git checkout -b test2 branch1
    test_must_fail git merge master >/dev/null 2>&1 &&
    ( yes "" | git mergetool file1 >/dev/null 2>&1 ) &&
    ( yes "" | git mergetool file2 >/dev/null 2>&1 ) &&
    ( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) &&
    test "$(printf x | cat file1 -)" = "$(printf "master updated\r\nx")" &&
    test "$(printf x | cat file2 -)" = "$(printf "master new\r\nx")" &&
    test "$(printf x | cat subdir/file3 -)" = "$(printf "master new sub\r\nx")" &&
    git commit -m "branch1 resolved with mergetool - autocrlf" &&
    git config core.autocrlf false &&
    git reset --hard
'

Does the resetting of core.autocrlf to false not break the subsequent
tests?

-- 
Charles Bailey
http://ccgi.hashpling.plus.com/blog/

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 0/6] Add core.autocrlf=true on cygwin by default during tests
  2009-05-11 20:54 ` Johannes Schindelin
@ 2009-05-12 18:16   ` Don Slutz
  0 siblings, 0 replies; 24+ messages in thread
From: Don Slutz @ 2009-05-12 18:16 UTC (permalink / raw)
  To: Johannes Schindelin, Eric Blake; +Cc: git

Based on:

On 5/11/2009 4:54 PM, Johannes Schindelin wrote:
> Hi,
>
> On Mon, 11 May 2009, Don Slutz wrote:
>
>   
>> This is a patch set to do the work from mail message:
>>
>> http://kerneltrap.org/mailarchive/git/2007/8/7/254415
>>
>> It is split into 6 parts.  This is because the tests do not work on
>> Linux if autocrlf=true.
>>
>> 1) The change to autocrlf=true by default for cygwin
>>     
>
> From the fallout of our unilateral decision in msysGit to set 
> autoCRLF=true all the time, I would advise against this change.
>
> Ciao,
> Dscho
>   

On 5/11/2009 4:04 PM, Eric Blake wrote:
> Don Slutz <Don.Slutz <at> SierraAtlantic.com> writes:
>
>   
>> This is a patch set to do the work from mail message:
>>
>> http://kerneltrap.org/mailarchive/git/2007/8/7/254415
>>
>> It is split into 6 parts.  This is because the tests do not work on
>> Linux if autocrlf=true.
>>
>> 1) The change to autocrlf=true by default for cygwin
>>     
>
> I help maintain the cygwin packaging of git, and I don't particularly like 
> patch 1/6.  Cygwin very much recommends that users stick with binary mounts, 
> where cr's are not inserted/stripped by default, and enabling autocrlf in that 
> situation is asking for problems (namely, the same set of problems as you would 
> have on Linux with autocrlf=true).  While adding an environment variable is 
> useful for the case of a user building git on cygwin with the intent of using a 
> text-mode mount, it goes against the grain of cygwin's recommendation of not 
> using text-mode mounts in the first place.  I would rather see the default 
> remain false, even on cygwin, unless the person building git takes steps to 
> activate it themselves.
>
>   
I will change 1/6 into adding the environment variable without the 
default change. v2 sometime soon.
   -Don


__________________________________________________________________________________________________________________
DISCLAIMER:"The information contained in this message and the attachments (if any) may be privileged and confidential and protected from disclosure. You are hereby notified that any unauthorized use, dissemination, distribution or copying of this communication, review, retransmission, or taking of any action based upon this information, by persons or entities other than the intended recipient, is strictly prohibited. If you are not the intended recipient or an employee or agent responsible for delivering this message, and have received this communication in error, please notify us immediately by replying to the message and kindly delete the original message, attachments, if any, and all its copies from your computer system. Thank you for your cooperation." 
________________________________________________________________________________________________________________

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 0/6] Add core.autocrlf=true on cygwin by default during tests
  2009-05-11 20:04 ` [PATCH 0/6] Add core.autocrlf=true on cygwin by default during tests Eric Blake
@ 2009-05-12 23:27   ` Junio C Hamano
  2009-05-13 17:41     ` Junio C Hamano
  0 siblings, 1 reply; 24+ messages in thread
From: Junio C Hamano @ 2009-05-12 23:27 UTC (permalink / raw)
  To: Eric Blake; +Cc: git

Eric Blake <ebb9@byu.net> writes:

> Don Slutz <Don.Slutz <at> SierraAtlantic.com> writes:
>
>> 
>> This is a patch set to do the work from mail message:
>> 
>> http://kerneltrap.org/mailarchive/git/2007/8/7/254415
>> 
>> It is split into 6 parts.  This is because the tests do not work on
>> Linux if autocrlf=true.
>> 
>> 1) The change to autocrlf=true by default for cygwin
>
> I help maintain the cygwin packaging of git, and I don't particularly like 
> patch 1/6.  Cygwin very much recommends that users stick with binary mounts, 
> where cr's are not inserted/stripped by default, and enabling autocrlf in that 
> situation is asking for problems...

Ok, thanks for the comments; I won't touch this for now myself, with
objections and concerns from people working on windows (you on Cygwin
side, and Dscho on msysgit side).

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 0/6] Add core.autocrlf=true on cygwin by default during tests
  2009-05-12 23:27   ` Junio C Hamano
@ 2009-05-13 17:41     ` Junio C Hamano
  0 siblings, 0 replies; 24+ messages in thread
From: Junio C Hamano @ 2009-05-13 17:41 UTC (permalink / raw)
  To: Don Slutz; +Cc: Eric Blake, git

Junio C Hamano <gitster@pobox.com> writes:

> Eric Blake <ebb9@byu.net> writes:
> ...
>> I help maintain the cygwin packaging of git, and I don't particularly like 
>> patch 1/6.  Cygwin very much recommends that users stick with binary mounts, 
>> where cr's are not inserted/stripped by default, and enabling autocrlf in that 
>> situation is asking for problems...
>
> Ok, thanks for the comments; I won't touch this for now myself, with
> objections and concerns from people working on windows (you on Cygwin
> side, and Dscho on msysgit side).

Just to make sure I do not cause misunderstanding, I did not mean I won't
touch this ever; I obviously meant "...until the concerns raised by windows
people are addressed to their satisfaction, as they are much better judge
than I am on this topic."

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH v2 0/7] Add GIT_TEST_AUTO_CRLF environment variable to set core.autocrlf on init
  2009-05-11 19:28 [PATCH 0/6] Add core.autocrlf=true on cygwin by default during tests Don Slutz
                   ` (2 preceding siblings ...)
  2009-05-11 20:54 ` Johannes Schindelin
@ 2009-05-13 19:35 ` Don Slutz
  2009-05-13 19:35   ` [PATCH v2 1/7] " Don Slutz
  3 siblings, 1 reply; 24+ messages in thread
From: Don Slutz @ 2009-05-13 19:35 UTC (permalink / raw)
  To: git; +Cc: Don Slutz

This is v2 of [PATCH 0/6] Add core.autocrlf=true on cygwin by default during tests

Changes: 

Changed #1 to no longer default to true for CYGWIN.

Modified t7610-mergetool.sh in #3 to correctly change core.autocrlf mode
and add test for the right thing in core.autocrlf=false

New patch #6 -- switch to using cmp instead of test_cmp for test that are
                checking autocrlf does the right thing.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH v2 1/7] Add GIT_TEST_AUTO_CRLF environment variable to set core.autocrlf on init
  2009-05-13 19:35 ` [PATCH v2 0/7] Add GIT_TEST_AUTO_CRLF environment variable to set core.autocrlf on init Don Slutz
@ 2009-05-13 19:35   ` Don Slutz
  2009-05-13 19:35     ` [PATCH v2 2/7] Add support functions for tests in core.autocrlf=true Don Slutz
  0 siblings, 1 reply; 24+ messages in thread
From: Don Slutz @ 2009-05-13 19:35 UTC (permalink / raw)
  To: git; +Cc: Don Slutz

Normal usage:

GIT_TEST_AUTO_CRLF=true make test

Signed-off-by: Don Slutz <Don.Slutz@SierraAtlantic.com>
---
 t/test-lib.sh |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index dad1437..6178e8c 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -59,7 +59,12 @@ export GIT_MERGE_VERBOSITY
 export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
 export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
 export EDITOR VISUAL
-GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}
+
+if test ! -z $GIT_TEST_AUTO_CRLF && test $GIT_TEST_AUTO_CRLF = true; then
+	GIT_TEST_CMP=${GIT_TEST_CMP:-diff -uw}
+else
+	GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}
+fi
 
 # Protect ourselves from common misconfiguration to export
 # CDPATH into the environment
@@ -493,6 +498,11 @@ test_create_repo () {
 	cd "$repo" || error "Cannot setup test environment"
 	"$GIT_EXEC_PATH/git-init" "--template=$TEST_DIRECTORY/../templates/blt/" >&3 2>&4 ||
 	error "cannot run git init -- have you built things yet?"
+	test ! -z "$GIT_TEST_AUTO_CRLF" &&
+	test_debug "echo Switching to autocrlf=$GIT_TEST_AUTO_CRLF" && {
+		git config core.autocrlf $GIT_TEST_AUTO_CRLF ||
+		error "Failed to switch to autocrlf=$GIT_TEST_AUTO_CRLF"
+	}
 	mv .git/hooks .git/hooks-disabled
 	cd "$owd"
 }
-- 
1.6.3.15.g49878

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v2 2/7] Add support functions for tests in core.autocrlf=true
  2009-05-13 19:35   ` [PATCH v2 1/7] " Don Slutz
@ 2009-05-13 19:35     ` Don Slutz
  2009-05-13 19:35       ` [PATCH v2 3/7] Fix tests to work with core.autocrlf=true -- new functions Don Slutz
  0 siblings, 1 reply; 24+ messages in thread
From: Don Slutz @ 2009-05-13 19:35 UTC (permalink / raw)
  To: git; +Cc: Don Slutz

test_external_with_only_warning() -- Ignore CRLF warnings
test_eq_cat() -- like "test foo = $(cat bar)" but works in any setting of
                 core.autocrlf
test_ne_cat() -- like "test foo != $(cat bar)"
test_cat_eq() -- like "test $(cat foo) = bar"

Signed-off-by: Don Slutz <Don.Slutz@SierraAtlantic.com>
---
 t/test-lib.sh |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 6178e8c..2e0fd43 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -453,6 +453,35 @@ test_external_without_stderr () {
 	fi
 }
 
+# Like test_external, but in addition tests that the command generated
+# only "warning: LF will be replaced by CRLF" output on stderr.
+test_external_with_only_warning () {
+	# The temporary file has no (and must have no) security
+	# implications.
+	tmp="$TMPDIR"; if [ -z "$tmp" ]; then tmp=/tmp; fi
+	stderr="$tmp/git-external-stderr.$$.tmp"
+	test_external "$@" 4> "$stderr"
+	[ -f "$stderr" ] || error "Internal error: $stderr disappeared."
+	descr="only warning: $1"
+	shift
+	say >&3 "expecting only warnings from previous command"
+	output=$(grep -v "warning: LF will be replaced by CRLF in" $stderr)
+	test_debug "echo non-warning: $output"
+	if [ -z "$output" ]; then
+		rm "$stderr"
+		test_ok_ "$descr"
+	else
+		if [ "$verbose" = t ]; then
+			output=`echo; echo Stderr is:; cat "$stderr"`
+		else
+			output=
+		fi
+		# rm first in case test_failure exits.
+		rm "$stderr"
+		test_failure_ "$descr" "$@" "$output"
+	fi
+}
+
 # This is not among top-level (test_expect_success | test_expect_failure)
 # but is a prefix that can be used in the test script, like:
 #
@@ -487,6 +516,30 @@ test_cmp() {
 	$GIT_TEST_CMP "$@"
 }
 
+# test_eq_cat is a helper function to compare a 1 word file
+# with a string.
+# It almost the same as: test foo = $(cat bar)
+# for: test_eq_cat foo bar
+#
+# However it works when core.autocrlf = true.
+
+test_eq_cat() {
+	test "$1" = "$(tr '\015' '\012' < "$2")"
+}
+
+# the but not-equal -- may not catch all cases
+
+test_ne_cat() {
+	test "$1" != "$(tr '\015' '\012' < "$2")"
+}
+
+# the same as test_eq_cat, but file is 1st.
+
+test_cat_eq() {
+	test "$(tr '\015' '\012' < "$1")" = "$2"
+}
+
+
 # Most tests can use the created repository, but some may need to create more.
 # Usage: test_create_repo <directory>
 test_create_repo () {
-- 
1.6.3.15.g49878

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v2 3/7] Fix tests to work with core.autocrlf=true -- new functions
  2009-05-13 19:35     ` [PATCH v2 2/7] Add support functions for tests in core.autocrlf=true Don Slutz
@ 2009-05-13 19:35       ` Don Slutz
  2009-05-13 19:35         ` [PATCH v2 4/7] Fix tests to work with core.autocrlf=true -- force false Don Slutz
  2009-05-14  7:43         ` [PATCH v2 3/7] Fix tests to work with core.autocrlf=true -- new functions Charles Bailey
  0 siblings, 2 replies; 24+ messages in thread
From: Don Slutz @ 2009-05-13 19:35 UTC (permalink / raw)
  To: git; +Cc: Don Slutz

Use the new functions to fix tests.

Signed-off-by: Don Slutz <Don.Slutz@SierraAtlantic.com>
---
 t/t0002-gitfile.sh                        |    3 +-
 t/t2004-checkout-cache-temp.sh            |   42 ++++++++++++++--------------
 t/t2008-checkout-subdir.sh                |   14 +++++-----
 t/t3404-rebase-interactive.sh             |    2 +-
 t/t3410-rebase-preserve-dropped-merges.sh |   12 ++++----
 t/t3413-rebase-hook.sh                    |   32 +++++++++++-----------
 t/t3503-cherry-pick-root.sh               |    2 +-
 t/t3903-stash.sh                          |   12 ++++----
 t/t4102-apply-rename.sh                   |    5 ++-
 t/t4124-apply-ws-rule.sh                  |   23 ++++++++++++---
 t/t4125-apply-ws-fuzz.sh                  |    9 +++++-
 t/t4128-apply-root.sh                     |    8 +++---
 t/t4150-am.sh                             |    4 +-
 t/t4252-am-options.sh                     |   16 ++++++++---
 t/t5000-tar-tree.sh                       |   12 +++++---
 t/t5001-archive-attr.sh                   |    3 ++
 t/t5520-pull.sh                           |   12 ++++----
 t/t7003-filter-branch.sh                  |    4 +-
 t/t7201-co.sh                             |    2 +-
 t/t7402-submodule-rebase.sh               |    4 +-
 t/t7610-mergetool.sh                      |   35 ++++++++++++++++++++----
 t/t7800-difftool.sh                       |   13 +++++----
 t/t9700-perl-git.sh                       |    2 +-
 23 files changed, 165 insertions(+), 106 deletions(-)

diff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh
index cb14425..3762714 100755
--- a/t/t0002-gitfile.sh
+++ b/t/t0002-gitfile.sh
@@ -60,7 +60,8 @@ test_expect_success 'final setup + check rev-parse --git-dir' '
 
 test_expect_success 'check hash-object' '
 	echo "foo" >bar &&
-	SHA=$(cat bar | git hash-object -w --stdin) &&
+	SHA=$(cat bar | git hash-object -w --stdin --path=bar) &&
+	test_debug "echo SHA=$SHA" &&
 	objck $SHA
 '
 
diff --git a/t/t2004-checkout-cache-temp.sh b/t/t2004-checkout-cache-temp.sh
index 36cca14..ce4c584 100755
--- a/t/t2004-checkout-cache-temp.sh
+++ b/t/t2004-checkout-cache-temp.sh
@@ -44,7 +44,7 @@ test $(wc -l <out) = 1 &&
 test $(cut "-d	" -f2 out) = path1 &&
 p=$(cut "-d	" -f1 out) &&
 test -f $p &&
-test $(cat $p) = tree1path1'
+test_cat_eq $p tree1path1'
 
 test_expect_success \
 'checkout all stage 0 to temporary files' '
@@ -57,7 +57,7 @@ do
 	test $(grep $f out | cut "-d	" -f2) = $f &&
 	p=$(grep $f out | cut "-d	" -f1) &&
 	test -f $p &&
-	test $(cat $p) = tree1$f
+	test_cat_eq $p tree1$f
 done'
 
 test_expect_success \
@@ -73,7 +73,7 @@ test $(wc -l <out) = 1 &&
 test $(cut "-d	" -f2 out) = path1 &&
 p=$(cut "-d	" -f1 out) &&
 test -f $p &&
-test $(cat $p) = tree2path1'
+test_cat_eq $p tree2path1'
 
 test_expect_success \
 'checkout all stage 2 to temporary files' '
@@ -85,7 +85,7 @@ do
 	test $(grep $f out | cut "-d	" -f2) = $f &&
 	p=$(grep $f out | cut "-d	" -f1) &&
 	test -f $p &&
-	test $(cat $p) = tree2$f
+	test_cat_eq $p tree2$f
 done'
 
 test_expect_success \
@@ -104,9 +104,9 @@ cut "-d	" -f1 out | (read s1 s2 s3 &&
 test -f $s1 &&
 test -f $s2 &&
 test -f $s3 &&
-test $(cat $s1) = tree1path1 &&
-test $(cat $s2) = tree2path1 &&
-test $(cat $s3) = tree3path1)'
+test_cat_eq $s1 tree1path1 &&
+test_cat_eq $s2 tree2path1 &&
+test_cat_eq $s3 tree3path1)'
 
 test_expect_success \
 'checkout some stages/one file to temporary files' '
@@ -118,8 +118,8 @@ cut "-d	" -f1 out | (read s1 s2 s3 &&
 test $s1 = . &&
 test -f $s2 &&
 test -f $s3 &&
-test $(cat $s2) = tree2path2 &&
-test $(cat $s3) = tree3path2)'
+test_cat_eq $s2 tree2path2 &&
+test_cat_eq $s3 tree3path2)'
 
 test_expect_success \
 'checkout all stages/all files to temporary files' '
@@ -138,9 +138,9 @@ grep path1 out | cut "-d	" -f1 | (read s1 s2 s3 &&
 test -f $s1 &&
 test -f $s2 &&
 test -f $s3 &&
-test $(cat $s1) = tree1path1 &&
-test $(cat $s2) = tree2path1 &&
-test $(cat $s3) = tree3path1)'
+test_cat_eq $s1 tree1path1 &&
+test_cat_eq $s2 tree2path1 &&
+test_cat_eq $s3 tree3path1)'
 
 test_expect_success \
 '-- path2: no stage 1, have stage 2 and 3' '
@@ -149,8 +149,8 @@ grep path2 out | cut "-d	" -f1 | (read s1 s2 s3 &&
 test $s1 = . &&
 test -f $s2 &&
 test -f $s3 &&
-test $(cat $s2) = tree2path2 &&
-test $(cat $s3) = tree3path2)'
+test_cat_eq $s2 tree2path2 &&
+test_cat_eq $s3 tree3path2)'
 
 test_expect_success \
 '-- path3: no stage 2, have stage 1 and 3' '
@@ -159,8 +159,8 @@ grep path3 out | cut "-d	" -f1 | (read s1 s2 s3 &&
 test -f $s1 &&
 test $s2 = . &&
 test -f $s3 &&
-test $(cat $s1) = tree1path3 &&
-test $(cat $s3) = tree3path3)'
+test_cat_eq $s1 tree1path3 &&
+test_cat_eq $s3 tree3path3)'
 
 test_expect_success \
 '-- path4: no stage 3, have stage 1 and 3' '
@@ -169,8 +169,8 @@ grep path4 out | cut "-d	" -f1 | (read s1 s2 s3 &&
 test -f $s1 &&
 test -f $s2 &&
 test $s3 = . &&
-test $(cat $s1) = tree1path4 &&
-test $(cat $s2) = tree2path4)'
+test_cat_eq $s1 tree1path4 &&
+test_cat_eq $s2 tree2path4)'
 
 test_expect_success \
 '-- asubdir/path5: no stage 2 and 3 have stage 1' '
@@ -179,7 +179,7 @@ grep asubdir/path5 out | cut "-d	" -f1 | (read s1 s2 s3 &&
 test -f $s1 &&
 test $s2 = . &&
 test $s3 = . &&
-test $(cat $s1) = tree1asubdir/path5)'
+test_cat_eq $s1 tree1asubdir/path5)'
 
 test_expect_success \
 'checkout --temp within subdir' '
@@ -191,7 +191,7 @@ test_expect_success \
  test -f ../$s1 &&
  test $s2 = . &&
  test $s3 = . &&
- test $(cat ../$s1) = tree1asubdir/path5)
+ test_cat_eq ../$s1 tree1asubdir/path5)
 )'
 
 test_expect_success SYMLINKS \
@@ -207,6 +207,6 @@ test $(wc -l <out) = 1 &&
 test $(cut "-d	" -f2 out) = a &&
 p=$(cut "-d	" -f1 out) &&
 test -f $p &&
-test $(cat $p) = b'
+test_cat_eq $p b'
 
 test_done
diff --git a/t/t2008-checkout-subdir.sh b/t/t2008-checkout-subdir.sh
index 3e098ab..7933197 100755
--- a/t/t2008-checkout-subdir.sh
+++ b/t/t2008-checkout-subdir.sh
@@ -27,14 +27,14 @@ test_expect_success 'remove and restore with relative path' '
 		cd dir1 &&
 		rm ../file0 &&
 		git checkout HEAD -- ../file0 &&
-		test "base" = "$(cat ../file0)" &&
+		test_eq_cat base ../file0 &&
 		rm ../dir2/file2 &&
 		git checkout HEAD -- ../dir2/file2 &&
-		test "bonjour" = "$(cat ../dir2/file2)" &&
+		test_eq_cat bonjour ../dir2/file2 &&
 		rm ../file0 ./file1 &&
 		git checkout HEAD -- .. &&
-		test "base" = "$(cat ../file0)" &&
-		test "hello" = "$(cat file1)"
+		test_eq_cat base ../file0 &&
+		test_eq_cat hello file1
 	)
 
 '
@@ -43,7 +43,7 @@ test_expect_success 'checkout with empty prefix' '
 
 	rm file0 &&
 	git checkout HEAD -- file0 &&
-	test "base" = "$(cat file0)"
+	test_eq_cat base file0
 
 '
 
@@ -51,10 +51,10 @@ test_expect_success 'checkout with simple prefix' '
 
 	rm dir1/file1 &&
 	git checkout HEAD -- dir1 &&
-	test "hello" = "$(cat dir1/file1)" &&
+	test_eq_cat hello dir1/file1 &&
 	rm dir1/file1 &&
 	git checkout HEAD -- dir1/file1 &&
-	test "hello" = "$(cat dir1/file1)"
+	test_eq_cat hello dir1/file1
 
 '
 
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index c32ff66..6990c77 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -162,7 +162,7 @@ test_expect_success 'squash' '
 	GIT_AUTHOR_NAME="Nitfol" git commit -m "nitfol" file7 &&
 	echo "******************************" &&
 	FAKE_LINES="1 squash 2" git rebase -i --onto master HEAD~2 &&
-	test B = $(cat file7) &&
+	test_eq_cat B file7 &&
 	test $(git rev-parse HEAD^) = $(git rev-parse master)
 '
 
diff --git a/t/t3410-rebase-preserve-dropped-merges.sh b/t/t3410-rebase-preserve-dropped-merges.sh
index c49143a..a044962 100755
--- a/t/t3410-rebase-preserve-dropped-merges.sh
+++ b/t/t3410-rebase-preserve-dropped-merges.sh
@@ -52,9 +52,9 @@ test_expect_success 'skip same-resolution merges with -p' '
 	test_commit K file7 file7 &&
 	git rebase -i -p L &&
 	test $(git rev-parse HEAD^^) = $(git rev-parse L) &&
-	test "23" = "$(cat file1)" &&
-	test "I" = "$(cat file6)" &&
-	test "file7" = "$(cat file7)"
+	test_eq_cat 23 file1 &&
+	test_eq_cat I file6 &&
+	test_eq_cat file7 file7
 '
 
 # A - B - C - D - E
@@ -77,9 +77,9 @@ test_expect_success 'keep different-resolution merges with -p' '
 	git add file1 &&
 	git rebase --continue &&
 	test $(git rev-parse HEAD^^^) = $(git rev-parse L2) &&
-	test "234" = "$(cat file1)" &&
-	test "I" = "$(cat file6)" &&
-	test "file7" = "$(cat file7)"
+	test_eq_cat 234 file1 &&
+	test_eq_cat I file6 &&
+	test_eq_cat file7 file7
 '
 
 test_done
diff --git a/t/t3413-rebase-hook.sh b/t/t3413-rebase-hook.sh
index 098b755..ac9ad05 100755
--- a/t/t3413-rebase-hook.sh
+++ b/t/t3413-rebase-hook.sh
@@ -27,14 +27,14 @@ test_expect_success 'rebase' '
 	git checkout test &&
 	git reset --hard side &&
 	git rebase master &&
-	test "z$(cat git)" = zworld
+	test_cat_eq git world
 '
 
 test_expect_success 'rebase -i' '
 	git checkout test &&
 	git reset --hard side &&
 	EDITOR=true git rebase -i master &&
-	test "z$(cat git)" = zworld
+	test_cat_eq git world
 '
 
 test_expect_success 'setup pre-rebase hook' '
@@ -50,8 +50,8 @@ test_expect_success 'pre-rebase hook gets correct input (1)' '
 	git checkout test &&
 	git reset --hard side &&
 	git rebase master &&
-	test "z$(cat git)" = zworld &&
-	test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,
+	test_cat_eq git world &&
+	test_cat_eq .git/PRE-REBASE-INPUT master,
 
 '
 
@@ -59,8 +59,8 @@ test_expect_success 'pre-rebase hook gets correct input (2)' '
 	git checkout test &&
 	git reset --hard side &&
 	git rebase master test &&
-	test "z$(cat git)" = zworld &&
-	test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,test
+	test_cat_eq git world &&
+	test_cat_eq .git/PRE-REBASE-INPUT master,test
 '
 
 test_expect_success 'pre-rebase hook gets correct input (3)' '
@@ -68,16 +68,16 @@ test_expect_success 'pre-rebase hook gets correct input (3)' '
 	git reset --hard side &&
 	git checkout master &&
 	git rebase master test &&
-	test "z$(cat git)" = zworld &&
-	test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,test
+	test_cat_eq git world &&
+	test_cat_eq .git/PRE-REBASE-INPUT master,test
 '
 
 test_expect_success 'pre-rebase hook gets correct input (4)' '
 	git checkout test &&
 	git reset --hard side &&
 	EDITOR=true git rebase -i master &&
-	test "z$(cat git)" = zworld &&
-	test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,
+	test_cat_eq git world &&
+	test_cat_eq .git/PRE-REBASE-INPUT master,
 
 '
 
@@ -85,8 +85,8 @@ test_expect_success 'pre-rebase hook gets correct input (5)' '
 	git checkout test &&
 	git reset --hard side &&
 	EDITOR=true git rebase -i master test &&
-	test "z$(cat git)" = zworld &&
-	test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,test
+	test_cat_eq git world &&
+	test_cat_eq .git/PRE-REBASE-INPUT master,test
 '
 
 test_expect_success 'pre-rebase hook gets correct input (6)' '
@@ -94,8 +94,8 @@ test_expect_success 'pre-rebase hook gets correct input (6)' '
 	git reset --hard side &&
 	git checkout master &&
 	EDITOR=true git rebase -i master test &&
-	test "z$(cat git)" = zworld &&
-	test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,test
+	test_cat_eq git world &&
+	test_cat_eq .git/PRE-REBASE-INPUT master,test
 '
 
 test_expect_success 'setup pre-rebase hook that fails' '
@@ -132,7 +132,7 @@ test_expect_success 'rebase --no-verify overrides pre-rebase (1)' '
 	git reset --hard side &&
 	git rebase --no-verify master &&
 	test "z$(git symbolic-ref HEAD)" = zrefs/heads/test &&
-	test "z$(cat git)" = zworld
+	test_cat_eq git world
 '
 
 test_expect_success 'rebase --no-verify overrides pre-rebase (2)' '
@@ -140,7 +140,7 @@ test_expect_success 'rebase --no-verify overrides pre-rebase (2)' '
 	git reset --hard side &&
 	EDITOR=true git rebase --no-verify -i master &&
 	test "z$(git symbolic-ref HEAD)" = zrefs/heads/test &&
-	test "z$(cat git)" = zworld
+	test_cat_eq git world
 '
 
 test_done
diff --git a/t/t3503-cherry-pick-root.sh b/t/t3503-cherry-pick-root.sh
index b0faa29..dfcd72a 100755
--- a/t/t3503-cherry-pick-root.sh
+++ b/t/t3503-cherry-pick-root.sh
@@ -23,7 +23,7 @@ test_expect_success setup '
 test_expect_success 'cherry-pick a root commit' '
 
 	git cherry-pick master &&
-	test first = $(cat file1)
+	test_eq_cat first file1
 
 '
 
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 7484cbe..7c1e169 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -49,7 +49,7 @@ test_expect_success 'apply stashed changes' '
 	test_tick &&
 	git commit -m other-file &&
 	git stash apply &&
-	test 3 = $(cat file) &&
+	test_eq_cat 3 file &&
 	test 1 = $(git show :file) &&
 	test 1 = $(git show HEAD:file)
 '
@@ -61,7 +61,7 @@ test_expect_success 'apply stashed changes (including index)' '
 	test_tick &&
 	git commit -m other-file &&
 	git stash apply --index &&
-	test 3 = $(cat file) &&
+	test_eq_cat 3 file &&
 	test 2 = $(git show :file) &&
 	test 1 = $(git show HEAD:file)
 '
@@ -83,7 +83,7 @@ test_expect_success 'drop top stash' '
 	git stash list > stashlist2 &&
 	diff stashlist1 stashlist2 &&
 	git stash apply &&
-	test 3 = $(cat file) &&
+	test_eq_cat 3 file &&
 	test 1 = $(git show :file) &&
 	test 1 = $(git show HEAD:file)
 '
@@ -97,13 +97,13 @@ test_expect_success 'drop middle stash' '
 	git stash drop stash@{1} &&
 	test 2 = $(git stash list | wc -l) &&
 	git stash apply &&
-	test 9 = $(cat file) &&
+	test_eq_cat 9 file &&
 	test 1 = $(git show :file) &&
 	test 1 = $(git show HEAD:file) &&
 	git reset --hard &&
 	git stash drop &&
 	git stash apply &&
-	test 3 = $(cat file) &&
+	test_eq_cat 3 file &&
 	test 1 = $(git show :file) &&
 	test 1 = $(git show HEAD:file)
 '
@@ -111,7 +111,7 @@ test_expect_success 'drop middle stash' '
 test_expect_success 'stash pop' '
 	git reset --hard &&
 	git stash pop &&
-	test 3 = $(cat file) &&
+	test_eq_cat 3 file &&
 	test 1 = $(git show :file) &&
 	test 1 = $(git show HEAD:file) &&
 	test 0 = $(git stash list | wc -l)
diff --git a/t/t4102-apply-rename.sh b/t/t4102-apply-rename.sh
index 1597965..5c7300d 100755
--- a/t/t4102-apply-rename.sh
+++ b/t/t4102-apply-rename.sh
@@ -43,7 +43,7 @@ test_expect_success FILEMODE validate \
 
 test_expect_success 'apply reverse' \
     'git apply -R --index --stat --summary --apply test-patch &&
-     test "$(cat foo)" = "This is foo"'
+     test_cat_eq foo "This is foo"'
 
 cat >test-patch <<\EOF
 diff --git a/foo b/bar
@@ -59,6 +59,7 @@ EOF
 
 test_expect_success 'apply copy' \
     'git apply --index --stat --summary --apply test-patch &&
-     test "$(cat bar)" = "This is bar" -a "$(cat foo)" = "This is foo"'
+     test_cat_eq bar "This is bar" &&
+     test_cat_eq foo "This is foo"'
 
 test_done
diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh
index f83322e..3933dd9 100755
--- a/t/t4124-apply-ws-rule.sh
+++ b/t/t4124-apply-ws-rule.sh
@@ -38,13 +38,19 @@ apply_patch () {
 	git apply "$@"
 }
 
+remove_cr () {
+	tr '\015' Q <"$1" | sed -e 's/Q$//'
+}
+
 test_fix () {
 
 	# fix should not barf
 	apply_patch --whitespace=fix || return 1
 
+	test_debug "echo patch applied: [$1]"
 	# find touched lines
-	diff file target | sed -n -e "s/^> //p" >fixed
+	remove_cr target >target1
+	diff file target1 | sed -n -e "s/^> //p" >fixed
 
 	# the changed lines are all expeced to change
 	fixed_cnt=$(wc -l <fixed)
@@ -52,6 +58,7 @@ test_fix () {
 	'') expect_cnt=$fixed_cnt ;;
 	?*) expect_cnt=$(grep "[$1]" <fixed | wc -l) ;;
 	esac
+	test_debug "echo fixed: $fixed_cnt vs $expect_cnt"
 	test $fixed_cnt -eq $expect_cnt || return 1
 
 	# and we are not missing anything
@@ -59,12 +66,14 @@ test_fix () {
 	'') expect_cnt=0 ;;
 	?*) expect_cnt=$(grep "[$1]" <file | wc -l) ;;
 	esac
+	test_debug "echo missing: $fixed_cnt vs $expect_cnt"
 	test $fixed_cnt -eq $expect_cnt || return 1
 
 	# Get the patch actually applied
 	git diff-files -p target >fixed-patch
 	test -s fixed-patch && return 0
 
+	test_debug "echo failed to apply, try and fix"
 	# Make sure it is complaint-free
 	>target
 	git apply --whitespace=error-all <fixed-patch
@@ -85,14 +94,16 @@ test_expect_success setup '
 test_expect_success 'whitespace=nowarn, default rule' '
 
 	apply_patch --whitespace=nowarn &&
-	diff file target
+	remove_cr target >target1 &&
+	diff file target1
 
 '
 
 test_expect_success 'whitespace=warn, default rule' '
 
 	apply_patch --whitespace=warn &&
-	diff file target
+	remove_cr target >target1 &&
+	diff file target1
 
 '
 
@@ -108,7 +119,8 @@ test_expect_success 'whitespace=error-all, no rule' '
 
 	git config core.whitespace -trailing,-space-before,-indent &&
 	apply_patch --whitespace=error-all &&
-	diff file target
+	remove_cr target >target1 &&
+	diff file target1
 
 '
 
@@ -117,7 +129,8 @@ test_expect_success 'whitespace=error-all, no rule (attribute)' '
 	git config --unset core.whitespace &&
 	echo "target -whitespace" >.gitattributes &&
 	apply_patch --whitespace=error-all &&
-	diff file target
+	remove_cr target >target1 &&
+	diff file target1
 
 '
 
diff --git a/t/t4125-apply-ws-fuzz.sh b/t/t4125-apply-ws-fuzz.sh
index 3b471b6..c02fe08 100755
--- a/t/t4125-apply-ws-fuzz.sh
+++ b/t/t4125-apply-ws-fuzz.sh
@@ -4,6 +4,10 @@ test_description='applying patch that has broken whitespaces in context'
 
 . ./test-lib.sh
 
+remove_cr () {
+	tr '\015' Q <"$1" | sed -e 's/Q$//'
+}
+
 test_expect_success setup '
 
 	>file &&
@@ -91,12 +95,13 @@ test_expect_success 'withfix (backward)' '
 
 	sed -e /h/d file-fixed >fixed-head &&
 	sed -e /h/d file >file-head &&
-	test_cmp fixed-head file-head &&
+	remove_cr file-head >file-head1
+	diff fixed-head file-head1 &&
 
 	sed -n -e /h/p file-fixed >fixed-tail &&
 	sed -n -e /h/p file >file-tail &&
 
-	! test_cmp fixed-tail file-tail
+	! diff fixed-tail file-tail
 
 '
 
diff --git a/t/t4128-apply-root.sh b/t/t4128-apply-root.sh
index 8f6aea4..a03a9c8 100755
--- a/t/t4128-apply-root.sh
+++ b/t/t4128-apply-root.sh
@@ -27,7 +27,7 @@ test_expect_success 'apply --directory -p (1)' '
 
 	git apply --directory=some/sub -p3 --index patch &&
 	test Bello = $(git show :some/sub/dir/file) &&
-	test Bello = $(cat some/sub/dir/file)
+	test_eq_cat Bello some/sub/dir/file
 
 '
 
@@ -36,7 +36,7 @@ test_expect_success 'apply --directory -p (2) ' '
 	git reset --hard initial &&
 	git apply --directory=some/sub/ -p3 --index patch &&
 	test Bello = $(git show :some/sub/dir/file) &&
-	test Bello = $(cat some/sub/dir/file)
+	test_eq_cat Bello some/sub/dir/file
 
 '
 
@@ -54,7 +54,7 @@ test_expect_success 'apply --directory (new file)' '
 	git reset --hard initial &&
 	git apply --directory=some/sub/dir/ --index patch &&
 	test content = $(git show :some/sub/dir/newfile) &&
-	test content = $(cat some/sub/dir/newfile)
+	test_eq_cat content some/sub/dir/newfile
 '
 
 cat > patch << EOF
@@ -89,7 +89,7 @@ test_expect_success 'apply --directory (quoted filename)' '
 	git reset --hard initial &&
 	git apply --directory=some/sub/dir/ --index patch &&
 	test content = $(git show :some/sub/dir/quotefile) &&
-	test content = $(cat some/sub/dir/quotefile)
+	test_eq_cat content some/sub/dir/quotefile
 '
 
 test_done
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index d6ebbae..27570b7 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -190,7 +190,7 @@ test_expect_success 'am --skip works' '
 	git am --skip &&
 	! test -d .git/rebase-apply &&
 	test -z "$(git diff lorem2^^ -- file)" &&
-	test goodbye = "$(cat another)"
+	test_eq_cat goodbye another
 '
 
 test_expect_success 'am --resolved works' '
@@ -201,7 +201,7 @@ test_expect_success 'am --resolved works' '
 	git add file &&
 	git am --resolved &&
 	! test -d .git/rebase-apply &&
-	test goodbye = "$(cat another)"
+	test_eq_cat goodbye another
 '
 
 test_expect_success 'am takes patches from a Pine mailbox' '
diff --git a/t/t4252-am-options.sh b/t/t4252-am-options.sh
index f603c1b..342fc1a 100755
--- a/t/t4252-am-options.sh
+++ b/t/t4252-am-options.sh
@@ -3,6 +3,10 @@
 test_description='git am with options and not losing them'
 . ./test-lib.sh
 
+remove_cr () {
+	tr '\015' Q <"$1" | sed -e 's/Q$//'
+}
+
 tm="$TEST_DIRECTORY/t4252"
 
 test_expect_success setup '
@@ -20,7 +24,8 @@ test_expect_success 'interrupted am --whitespace=fix' '
 	test_must_fail git am --whitespace=fix "$tm"/am-test-1-? &&
 	git am --skip &&
 	grep 3 file-1 &&
-	grep "^Six$" file-2
+	remove_cr file-2 >file-2a &&
+	grep "^Six$" file-2a
 '
 
 test_expect_success 'interrupted am -C1' '
@@ -29,7 +34,8 @@ test_expect_success 'interrupted am -C1' '
 	test_must_fail git am -C1 "$tm"/am-test-2-? &&
 	git am --skip &&
 	grep 3 file-1 &&
-	grep "^Three$" file-2
+	remove_cr file-2 >file-2a &&
+	grep "^Three$" file-2a
 '
 
 test_expect_success 'interrupted am -p2' '
@@ -38,7 +44,8 @@ test_expect_success 'interrupted am -p2' '
 	test_must_fail git am -p2 "$tm"/am-test-3-? &&
 	git am --skip &&
 	grep 3 file-1 &&
-	grep "^Three$" file-2
+	remove_cr file-2 >file-2a &&
+	grep "^Three$" file-2a
 '
 
 test_expect_success 'interrupted am -C1 -p2' '
@@ -47,7 +54,8 @@ test_expect_success 'interrupted am -C1 -p2' '
 	test_must_fail git am -p2 -C1 "$tm"/am-test-4-? &&
 	git am --skip &&
 	grep 3 file-1 &&
-	grep "^Three$" file-2
+	remove_cr file-2 >file-2a &&
+	grep "^Three$" file-2a
 '
 
 test_expect_success 'interrupted am --directory="frotz nitfol"' '
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index abb41b0..28d6291 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -25,6 +25,8 @@ commit id embedding:
 '
 
 . ./test-lib.sh
+autocrlf=$(git config core.autocrlf)
+
 UNZIP=${UNZIP:-unzip}
 
 SUBSTFORMAT=%H%n
@@ -66,6 +68,8 @@ test_expect_success \
     'git clone --bare . bare.git &&
      cp .git/info/attributes bare.git/info/attributes'
 
+test ! -z "$autocrlf" && (cd bare.git; git config core.autocrlf $autocrlf)
+
 test_expect_success \
     'remove ignored file' \
     'rm a/ignored'
@@ -118,7 +122,7 @@ test_expect_success \
 
 test_expect_success \
     'validate file contents' \
-    'diff -r a b/a'
+    'diff -rb a b/a'
 
 test_expect_success \
     'git tar-tree with prefix' \
@@ -135,7 +139,7 @@ test_expect_success \
 
 test_expect_success \
     'validate file contents with prefix' \
-    'diff -r a c/prefix/a'
+    'diff -rb a c/prefix/a'
 
 test_expect_success \
     'create archives with substfiles' \
@@ -203,7 +207,7 @@ test_expect_success UNZIP \
 
 test_expect_success UNZIP \
     'validate file contents' \
-    'diff -r a d/a'
+    'diff -rb a d/a'
 
 test_expect_success \
     'git archive --format=zip with prefix' \
@@ -220,7 +224,7 @@ test_expect_success UNZIP \
 
 test_expect_success UNZIP \
     'validate file contents with prefix' \
-    'diff -r a e/prefix/a'
+    'diff -rb a e/prefix/a'
 
 test_expect_success \
     'git archive --list outside of a git repo' \
diff --git a/t/t5001-archive-attr.sh b/t/t5001-archive-attr.sh
index 426b319..2efa018 100755
--- a/t/t5001-archive-attr.sh
+++ b/t/t5001-archive-attr.sh
@@ -3,6 +3,7 @@
 test_description='git archive attribute tests'
 
 . ./test-lib.sh
+autocrlf=$(git config core.autocrlf)
 
 SUBSTFORMAT=%H%n
 
@@ -39,6 +40,8 @@ test_expect_success 'setup' '
 	cp .git/info/attributes bare/info/attributes
 '
 
+test ! -z "$autocrlf" && (cd bare; git config core.autocrlf $autocrlf)
+
 test_expect_success 'git archive' '
 	git archive HEAD >archive.tar &&
 	(mkdir archive && cd archive && "$TAR" xf -) <archive.tar
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index 725771f..4d4e7ac 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -49,9 +49,9 @@ test_expect_success 'test . as a remote' '
 	echo updated >file &&
 	git commit -a -m updated &&
 	git checkout copy &&
-	test `cat file` = file &&
+	test_cat_eq file file &&
 	git pull &&
-	test `cat file` = updated
+	test_cat_eq file updated
 '
 
 test_expect_success 'the default remote . should not break explicit pull' '
@@ -60,9 +60,9 @@ test_expect_success 'the default remote . should not break explicit pull' '
 	git commit -a -m modified &&
 	git checkout copy &&
 	git reset --hard HEAD^ &&
-	test `cat file` = file &&
+	test_cat_eq file file &&
 	git pull . second &&
-	test `cat file` = modified
+	test_cat_eq file modified
 '
 
 test_expect_success '--rebase' '
@@ -99,8 +99,8 @@ test_expect_success '--rebase with rebased upstream' '
 	echo file > file2 &&
 	git commit -m to-rebase file2 &&
 	git pull --rebase me copy &&
-	test "conflicting modification" = "$(cat file)" &&
-	test file = $(cat file2)
+	test_eq_cat "conflicting modification" file &&
+	test_eq_cat file file2
 
 '
 
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index 329c851..c6e9fb5 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -72,7 +72,7 @@ test_expect_success 'test that the file was renamed' '
 	test d = "$(git show HEAD:doh --)" &&
 	! test -f d &&
 	test -f doh &&
-	test d = "$(cat doh)"
+	test_eq_cat d doh
 '
 
 test_expect_success 'rewrite, renaming a specific directory' '
@@ -85,7 +85,7 @@ test_expect_success 'test that the directory was renamed' '
 	test -d diroh &&
 	! test -d diroh/dir &&
 	test -f diroh/d &&
-	test dir/d = "$(cat diroh/d)"
+	test_eq_cat dir/d diroh/d
 '
 
 git tag oldD HEAD~4
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index bdb808a..62f58eb 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -434,7 +434,7 @@ test_expect_success 'checkout unmerged stage' '
 	test_cmp expect filf &&
 	test_cmp expect file &&
 	git checkout --theirs file &&
-	test ztheirside = "z$(cat file)"
+	test_eq_cat theirside file
 '
 
 test_expect_success 'checkout with --merge' '
diff --git a/t/t7402-submodule-rebase.sh b/t/t7402-submodule-rebase.sh
index f919c8d..8e5d747 100755
--- a/t/t7402-submodule-rebase.sh
+++ b/t/t7402-submodule-rebase.sh
@@ -80,11 +80,11 @@ test_expect_success 'stash with a dirty submodule' '
 	echo new > file &&
 	CURRENT=$(cd submodule && git rev-parse HEAD) &&
 	git stash &&
-	test new != $(cat file) &&
+	test_ne_cat new file &&
 	test submodule = $(git diff --name-only) &&
 	test $CURRENT = $(cd submodule && git rev-parse HEAD) &&
 	git stash apply &&
-	test new = $(cat file) &&
+	test_eq_cat new file &&
 	test $CURRENT = $(cd submodule && git rev-parse HEAD)
 
 '
diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh
index e768c3e..a3794a3 100755
--- a/t/t7610-mergetool.sh
+++ b/t/t7610-mergetool.sh
@@ -8,6 +8,8 @@ test_description='git mergetool
 Testing basic merge tool invocation'
 
 . ./test-lib.sh
+autocrlf=$(git config core.autocrlf)
+test -z "$autocrlf" && autocrlf=false
 
 # All the mergetool test work by checking out a temporary branch based
 # off 'branch1' and then merging in master and checking the results of
@@ -45,15 +47,17 @@ test_expect_success 'custom mergetool' '
     ( yes "" | git mergetool file1 >/dev/null 2>&1 ) &&
     ( yes "" | git mergetool file2 >/dev/null 2>&1 ) &&
     ( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) &&
-    test "$(cat file1)" = "master updated" &&
-    test "$(cat file2)" = "master new" &&
-    test "$(cat subdir/file3)" = "master new sub" &&
+    test_cat_eq file1 "master updated" &&
+    test_cat_eq file2 "master new" &&
+    test_cat_eq subdir/file3 "master new sub" &&
     git commit -m "branch1 resolved with mergetool"
 '
 
 test_expect_success 'mergetool crlf' '
     git config core.autocrlf true &&
-    git checkout -b test2 branch1
+    rm -f .git/index &&
+    git reset --hard &&
+    git checkout -b test2 branch1 &&
     test_must_fail git merge master >/dev/null 2>&1 &&
     ( yes "" | git mergetool file1 >/dev/null 2>&1 ) &&
     ( yes "" | git mergetool file2 >/dev/null 2>&1 ) &&
@@ -62,16 +66,35 @@ test_expect_success 'mergetool crlf' '
     test "$(printf x | cat file2 -)" = "$(printf "master new\r\nx")" &&
     test "$(printf x | cat subdir/file3 -)" = "$(printf "master new sub\r\nx")" &&
     git commit -m "branch1 resolved with mergetool - autocrlf" &&
+    git config core.autocrlf $autocrlf &&
+    rm -f .git/index &&
+    git reset --hard
+'
+
+test_expect_success 'mergetool lf' '
     git config core.autocrlf false &&
+    rm -f .git/index &&
+    git reset --hard &&
+    git checkout -b test3 branch1 &&
+    test_must_fail git merge master >/dev/null 2>&1 &&
+    ( yes "" | git mergetool file1 >/dev/null 2>&1 ) &&
+    ( yes "" | git mergetool file2 >/dev/null 2>&1 ) &&
+    ( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) &&
+    test "$(printf x | cat file1 -)" = "$(printf "master updated\nx")" &&
+    test "$(printf x | cat file2 -)" = "$(printf "master new\nx")" &&
+    test "$(printf x | cat subdir/file3 -)" = "$(printf "master new sub\nx")" &&
+    git commit -m "branch1 resolved with mergetool - autocrlf2" &&
+    git config core.autocrlf $autocrlf &&
+    rm -f .git/index &&
     git reset --hard
 '
 
 test_expect_success 'mergetool in subdir' '
-    git checkout -b test3 branch1
+    git checkout -b test4 branch1 &&
     cd subdir && (
     test_must_fail git merge master >/dev/null 2>&1 &&
     ( yes "" | git mergetool file3 >/dev/null 2>&1 ) &&
-    test "$(cat file3)" = "master new sub" )
+    test_cat_eq file3 "master new sub" )
 '
 
 # We can't merge files from parent directories when running mergetool
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index ebdccf9..b95069a 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -35,11 +35,12 @@ restore_test_defaults()
 	unset GIT_DIFFTOOL_PROMPT
 	unset GIT_DIFFTOOL_NO_PROMPT
 	git config diff.tool test-tool &&
-	git config difftool.test-tool.cmd 'cat $LOCAL'
+	git config difftool.test-tool.cmd "tr '\015' '\012' <\$LOCAL"
 }
 
 prompt_given()
 {
+	test_debug "echo prompt_given:$1"
 	prompt="$1"
 	test "$prompt" = "Hit return to launch 'test-tool': branch"
 }
@@ -59,7 +60,7 @@ test_expect_success 'setup' '
 # Configure a custom difftool.<tool>.cmd and use it
 test_expect_success 'custom commands' '
 	restore_test_defaults &&
-	git config difftool.test-tool.cmd "cat \$REMOTE" &&
+	git config difftool.test-tool.cmd "tr '\''\015'\'' '\''\012'\'' <\$REMOTE" &&
 
 	diff=$(git difftool --no-prompt branch) &&
 	test "$diff" = "master" &&
@@ -136,7 +137,7 @@ test_expect_success 'GIT_DIFFTOOL_PROMPT variable' '
 	GIT_DIFFTOOL_PROMPT=true &&
 	export GIT_DIFFTOOL_PROMPT &&
 
-	prompt=$(echo | git difftool --prompt branch | tail -1) &&
+	prompt=$(echo | git difftool --prompt branch | head -3 | tail -1) &&
 	prompt_given "$prompt" &&
 
 	restore_test_defaults
@@ -166,7 +167,7 @@ test_expect_success 'difftool.prompt can overridden with -y' '
 test_expect_success 'difftool.prompt can overridden with --prompt' '
 	git config difftool.prompt false &&
 
-	prompt=$(echo | git difftool --prompt branch | tail -1) &&
+	prompt=$(echo | git difftool --prompt branch | head -3 | tail -1) &&
 	prompt_given "$prompt" &&
 
 	restore_test_defaults
@@ -179,7 +180,7 @@ test_expect_success 'difftool last flag wins' '
 
 	restore_test_defaults &&
 
-	prompt=$(echo | git difftool --no-prompt --prompt branch | tail -1) &&
+	prompt=$(echo | git difftool --no-prompt --prompt branch | head -3 | tail -1) &&
 	prompt_given "$prompt" &&
 
 	restore_test_defaults
@@ -190,7 +191,7 @@ test_expect_success 'difftool last flag wins' '
 test_expect_success 'difftool + mergetool config variables' '
 	remove_config_vars
 	git config merge.tool test-tool &&
-	git config mergetool.test-tool.cmd "cat \$LOCAL" &&
+	git config mergetool.test-tool.cmd "tr '\''\015'\'' '\''\012'\'' <\$LOCAL" &&
 
 	diff=$(git difftool --no-prompt branch) &&
 	test "$diff" = "branch" &&
diff --git a/t/t9700-perl-git.sh b/t/t9700-perl-git.sh
index b4ca244..76f741f 100755
--- a/t/t9700-perl-git.sh
+++ b/t/t9700-perl-git.sh
@@ -42,7 +42,7 @@ test_expect_success \
      git config --add test.int 2k
      '
 
-test_external_without_stderr \
+test_external_with_only_warning \
     'Perl API' \
     perl "$TEST_DIRECTORY"/t9700/test.pl
 
-- 
1.6.3.15.g49878

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v2 4/7] Fix tests to work with core.autocrlf=true -- force false
  2009-05-13 19:35       ` [PATCH v2 3/7] Fix tests to work with core.autocrlf=true -- new functions Don Slutz
@ 2009-05-13 19:35         ` Don Slutz
  2009-05-13 19:35           ` [PATCH v2 5/7] Fix tests to work with core.autocrlf=true -- cmp to test_cmp Don Slutz
  2009-05-14  7:43         ` [PATCH v2 3/7] Fix tests to work with core.autocrlf=true -- new functions Charles Bailey
  1 sibling, 1 reply; 24+ messages in thread
From: Don Slutz @ 2009-05-13 19:35 UTC (permalink / raw)
  To: git; +Cc: Don Slutz

Force core.autocrlf=false for these tests.  Most of these tests are checking
for whitespace differences and so are not simple to fix.  The rest are not
clear how to fix.

Signed-off-by: Don Slutz <Don.Slutz@SierraAtlantic.com>
---
 t/t1002-read-tree-m-u-2way.sh |    3 ++-
 t/t4015-diff-whitespace.sh    |    2 ++
 t/t4019-diff-wserror.sh       |    1 +
 t/t4116-apply-reverse.sh      |    1 +
 t/t4200-rerere.sh             |    2 ++
 5 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh
index 5e40cec..acc9474 100755
--- a/t/t1002-read-tree-m-u-2way.sh
+++ b/t/t1002-read-tree-m-u-2way.sh
@@ -37,7 +37,8 @@ check_cache_at () {
 
 test_expect_success \
     setup \
-    'echo frotz >frotz &&
+    'git config core.autocrlf false &&
+     echo frotz >frotz &&
      echo nitfol >nitfol &&
      echo bozbar >bozbar &&
      echo rezrov >rezrov &&
diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index 6d13da3..122557e 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -9,6 +9,8 @@ test_description='Test special whitespace in diff engine.
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/diff-lib.sh
 
+test_expect_success "setup" 'git config core.autocrlf false'
+
 # Ray Lehtiniemi's example
 
 cat << EOF > x
diff --git a/t/t4019-diff-wserror.sh b/t/t4019-diff-wserror.sh
index 84a1fe3..a580403 100755
--- a/t/t4019-diff-wserror.sh
+++ b/t/t4019-diff-wserror.sh
@@ -6,6 +6,7 @@ test_description='diff whitespace error detection'
 
 test_expect_success setup '
 
+	git config core.autocrlf false &&
 	git config diff.color.whitespace "blue reverse" &&
 	>F &&
 	git add F &&
diff --git a/t/t4116-apply-reverse.sh b/t/t4116-apply-reverse.sh
index 2298ece..a846be6 100755
--- a/t/t4116-apply-reverse.sh
+++ b/t/t4116-apply-reverse.sh
@@ -11,6 +11,7 @@ test_description='git apply in reverse
 
 test_expect_success setup '
 
+	git config core.autocrlf false &&
 	for i in a b c d e f g h i j k l m n; do echo $i; done >file1 &&
 	perl -pe "y/ijk/\\000\\001\\002/" <file1 >file2 &&
 
diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
index a6bc028..5e6cc82 100755
--- a/t/t4200-rerere.sh
+++ b/t/t4200-rerere.sh
@@ -8,6 +8,8 @@ test_description='git rerere
 
 . ./test-lib.sh
 
+git config core.autocrlf false
+
 cat > a1 << EOF
 Some title
 ==========
-- 
1.6.3.15.g49878

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v2 5/7] Fix tests to work with core.autocrlf=true -- cmp to test_cmp
  2009-05-13 19:35         ` [PATCH v2 4/7] Fix tests to work with core.autocrlf=true -- force false Don Slutz
@ 2009-05-13 19:35           ` Don Slutz
  2009-05-13 19:35             ` [PATCH v2 6/7] Fix tests to work with core.autocrlf=true -- test_cmp to cmp Don Slutz
  0 siblings, 1 reply; 24+ messages in thread
From: Don Slutz @ 2009-05-13 19:35 UTC (permalink / raw)
  To: git; +Cc: Don Slutz

Switch from using cmp to using test_cmp in these tests.

Signed-off-by: Don Slutz <Don.Slutz@SierraAtlantic.com>
---
 t/t0021-conversion.sh        |   12 ++++++------
 t/t1020-subdirectory.sh      |   12 ++++++------
 t/t4127-apply-same-fn.sh     |    2 +-
 t/t6021-merge-criss-cross.sh |    2 +-
 t/t6026-merge-attr.sh        |   10 +++++-----
 5 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index 8fc39d7..7a6d8c7 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -33,17 +33,17 @@ test_expect_success setup '
 	git checkout -- test test.t test.i
 '
 
-script='s/^\$Id: \([0-9a-f]*\) \$/\1/p'
-
 test_expect_success check '
 
-	cmp test.o test &&
-	cmp test.o test.t &&
+	test_cmp test.o test &&
+	test_cmp test.o test.t &&
 
 	# ident should be stripped in the repository
 	git diff --raw --exit-code :test :test.i &&
 	id=$(git rev-parse --verify :test) &&
-	embedded=$(sed -ne "$script" test.i) &&
+	test_debug "echo id=$id"
+	embedded=$(grep Id: test.i | cut -d\  -f2) &&
+	test_debug "echo embedded=$embedded"
 	test "z$id" = "z$embedded" &&
 
 	git cat-file blob :test.t > test.r &&
@@ -85,7 +85,7 @@ test_expect_success expanded_in_repo '
 	rm -f expanded-keywords &&
 	git checkout -- expanded-keywords &&
 	cat expanded-keywords &&
-	cmp expanded-keywords expected-output
+	test_cmp expanded-keywords expected-output
 '
 
 test_done
diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh
index 210e594..ce67e6c 100755
--- a/t/t1020-subdirectory.sh
+++ b/t/t1020-subdirectory.sh
@@ -86,10 +86,10 @@ test_expect_success 'write-tree' '
 test_expect_success 'checkout-index' '
 	cd "$HERE" &&
 	git checkout-index -f -u one &&
-	cmp one original.one &&
+	test_cmp one original.one &&
 	cd dir &&
 	git checkout-index -f -u two &&
-	cmp two ../original.two
+	test_cmp two ../original.two
 '
 
 test_expect_success 'read-tree' '
@@ -97,13 +97,13 @@ test_expect_success 'read-tree' '
 	rm -f one dir/two &&
 	tree=`git write-tree` &&
 	git read-tree --reset -u "$tree" &&
-	cmp one original.one &&
-	cmp dir/two original.two &&
+	test_cmp one original.one &&
+	test_cmp dir/two original.two &&
 	cd dir &&
 	rm -f two &&
 	git read-tree --reset -u "$tree" &&
-	cmp two ../original.two &&
-	cmp ../one ../original.one
+	test_cmp two ../original.two &&
+	test_cmp ../one ../original.one
 '
 
 test_expect_success 'no file/rev ambiguity check inside .git' '
diff --git a/t/t4127-apply-same-fn.sh b/t/t4127-apply-same-fn.sh
index 3a8202e..66b774f 100755
--- a/t/t4127-apply-same-fn.sh
+++ b/t/t4127-apply-same-fn.sh
@@ -27,7 +27,7 @@ test_expect_success 'apply same filename with independent changes' '
 	cp same_fn same_fn2 &&
 	git reset --hard &&
 	git apply patch0 &&
-	diff same_fn same_fn2
+	test_cmp same_fn same_fn2
 '
 
 test_expect_success 'apply same filename with overlapping changes' '
diff --git a/t/t6021-merge-criss-cross.sh b/t/t6021-merge-criss-cross.sh
index 331b9b0..53fdfd8 100755
--- a/t/t6021-merge-criss-cross.sh
+++ b/t/t6021-merge-criss-cross.sh
@@ -87,7 +87,7 @@ cat > file-expect <<EOF
 9
 EOF
 
-test_expect_success 'Criss-cross merge result' 'cmp file file-expect'
+test_expect_success 'Criss-cross merge result' 'test_cmp file file-expect'
 
 test_expect_success 'Criss-cross merge fails (-s resolve)' \
 'git reset --hard A^ &&
diff --git a/t/t6026-merge-attr.sh b/t/t6026-merge-attr.sh
index 1ba0a25..0b57c68 100755
--- a/t/t6026-merge-attr.sh
+++ b/t/t6026-merge-attr.sh
@@ -63,7 +63,7 @@ test_expect_success 'check merge result in working tree' '
 
 	git cat-file -p HEAD:binary >binary-orig &&
 	grep "<<<<<<<" text &&
-	cmp binary-orig binary &&
+	test_cmp binary-orig binary &&
 	! grep "<<<<<<<" union &&
 	grep Master union &&
 	grep Side union
@@ -104,14 +104,14 @@ test_expect_success 'custom merge backend' '
 
 	git merge master &&
 
-	cmp binary union &&
+	test_cmp binary union &&
 	sed -e 1,3d text >check-1 &&
 	o=$(git unpack-file master^:text) &&
 	a=$(git unpack-file side^:text) &&
 	b=$(git unpack-file master:text) &&
 	sh -c "./custom-merge $o $a $b 0" &&
 	sed -e 1,3d $a >check-2 &&
-	cmp check-1 check-2 &&
+	test_cmp check-1 check-2 &&
 	rm -f $o $a $b
 '
 
@@ -131,14 +131,14 @@ test_expect_success 'custom merge backend' '
 		echo "Ok, conflicted"
 	fi &&
 
-	cmp binary union &&
+	test_cmp binary union &&
 	sed -e 1,3d text >check-1 &&
 	o=$(git unpack-file master^:text) &&
 	a=$(git unpack-file anchor:text) &&
 	b=$(git unpack-file master:text) &&
 	sh -c "./custom-merge $o $a $b 0" &&
 	sed -e 1,3d $a >check-2 &&
-	cmp check-1 check-2 &&
+	test_cmp check-1 check-2 &&
 	rm -f $o $a $b
 '
 
-- 
1.6.3.15.g49878

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v2 6/7] Fix tests to work with core.autocrlf=true -- test_cmp to cmp
  2009-05-13 19:35           ` [PATCH v2 5/7] Fix tests to work with core.autocrlf=true -- cmp to test_cmp Don Slutz
@ 2009-05-13 19:35             ` Don Slutz
  2009-05-13 19:35               ` [PATCH v2 7/7] Add 'make test-text' core.autocrlf=true Don Slutz
  0 siblings, 1 reply; 24+ messages in thread
From: Don Slutz @ 2009-05-13 19:35 UTC (permalink / raw)
  To: git; +Cc: Don Slutz

Switch from using test_cmp to using cmp in these tests. They are
checking for correct CRLF handling.

Signed-off-by: Don Slutz <Don.Slutz@SierraAtlantic.com>
---
 t/t0024-crlf-archive.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t0024-crlf-archive.sh b/t/t0024-crlf-archive.sh
index c7d0324..af084e5 100755
--- a/t/t0024-crlf-archive.sh
+++ b/t/t0024-crlf-archive.sh
@@ -22,7 +22,7 @@ test_expect_success 'tar archive' '
 	git archive --format=tar HEAD |
 	( mkdir untarred && cd untarred && "$TAR" -xf - )
 
-	test_cmp sample untarred/sample
+	cmp sample untarred/sample
 
 '
 
@@ -39,7 +39,7 @@ test_expect_success UNZIP 'zip archive' '
 
 	( mkdir unzipped && cd unzipped && unzip ../test.zip ) &&
 
-	test_cmp sample unzipped/sample
+	cmp sample unzipped/sample
 
 '
 
-- 
1.6.3.15.g49878

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH v2 7/7] Add 'make test-text' core.autocrlf=true
  2009-05-13 19:35             ` [PATCH v2 6/7] Fix tests to work with core.autocrlf=true -- test_cmp to cmp Don Slutz
@ 2009-05-13 19:35               ` Don Slutz
  0 siblings, 0 replies; 24+ messages in thread
From: Don Slutz @ 2009-05-13 19:35 UTC (permalink / raw)
  To: git; +Cc: Don Slutz

This will test with core.autocrlf=true by default and
test using a text mount in CYGWIN

Signed-off-by: Don Slutz <Don.Slutz@SierraAtlantic.com>
---
 Makefile |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 6e21643..2d85972 100644
--- a/Makefile
+++ b/Makefile
@@ -1482,6 +1482,17 @@ export NO_SVN_TESTS
 test: all
 	$(MAKE) -C t/ all
 
+test-text: all
+	@echo Test core.autocrlf=true
+ifeq ($(uname_O),Cygwin)
+	@echo Test text mode mount
+	mount -f -u -t $(shell sh -c 'cygpath -m -a t') $(shell sh -c 'cygpath -u -a t')
+	GIT_TEST_AUTO_CRLF=$${GIT_TEST_AUTO_CRLF:-true} $(MAKE) -C t/ all
+	umount -u $(shell sh -c 'cygpath -u -a t')
+else
+	GIT_TEST_AUTO_CRLF=$${GIT_TEST_AUTO_CRLF:-true} $(MAKE) -C t/ all
+endif
+
 test-ctype$X: ctype.o
 
 test-date$X: date.o ctype.o
-- 
1.6.3.15.g49878

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH v2 3/7] Fix tests to work with core.autocrlf=true -- new functions
  2009-05-13 19:35       ` [PATCH v2 3/7] Fix tests to work with core.autocrlf=true -- new functions Don Slutz
  2009-05-13 19:35         ` [PATCH v2 4/7] Fix tests to work with core.autocrlf=true -- force false Don Slutz
@ 2009-05-14  7:43         ` Charles Bailey
  2009-05-14 14:39           ` Don Slutz
  1 sibling, 1 reply; 24+ messages in thread
From: Charles Bailey @ 2009-05-14  7:43 UTC (permalink / raw)
  To: Don Slutz; +Cc: git

On Wed, May 13, 2009 at 03:35:44PM -0400, Don Slutz wrote:
>  test_expect_success 'mergetool crlf' '
>      git config core.autocrlf true &&
> -    git checkout -b test2 branch1
> +    rm -f .git/index &&
> +    git reset --hard &&
> +    git checkout -b test2 branch1 &&
>      test_must_fail git merge master >/dev/null 2>&1 &&
>      ( yes "" | git mergetool file1 >/dev/null 2>&1 ) &&
>      ( yes "" | git mergetool file2 >/dev/null 2>&1 ) &&
> @@ -62,16 +66,35 @@ test_expect_success 'mergetool crlf' '
>      test "$(printf x | cat file2 -)" = "$(printf "master new\r\nx")" &&
>      test "$(printf x | cat subdir/file3 -)" = "$(printf "master new sub\r\nx")" &&
>      git commit -m "branch1 resolved with mergetool - autocrlf" &&
> +    git config core.autocrlf $autocrlf &&
> +    rm -f .git/index &&
> +    git reset --hard
> +'
> +
> +test_expect_success 'mergetool lf' '
>      git config core.autocrlf false &&
> +    rm -f .git/index &&
> +    git reset --hard &&
> +    git checkout -b test3 branch1 &&
> +    test_must_fail git merge master >/dev/null 2>&1 &&
> +    ( yes "" | git mergetool file1 >/dev/null 2>&1 ) &&
> +    ( yes "" | git mergetool file2 >/dev/null 2>&1 ) &&
> +    ( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) &&
> +    test "$(printf x | cat file1 -)" = "$(printf "master updated\nx")" &&
> +    test "$(printf x | cat file2 -)" = "$(printf "master new\nx")" &&
> +    test "$(printf x | cat subdir/file3 -)" = "$(printf "master new sub\nx")" &&
> +    git commit -m "branch1 resolved with mergetool - autocrlf2" &&
> +    git config core.autocrlf $autocrlf &&
> +    rm -f .git/index &&
>      git reset --hard
>  '

Have I missed some previous recent discussion about this patch series?
I know that you referenced that long Aug 2007 thread about autocrlf,
but is there some more recent discussion about how the test suite
works / should work?

mergetool isn't the prime implementor of autocrlf, but it does have
some checks to make sure that it works with autocrlf. My impression -
probably incorrect - has been that autocrlf is off for the purposes of
building and testing git on all platforms, but that some packages
switch it on by default on install for user convenience on platforms
where this is appropriate.

Your patch seems to be about allowing the entire test suite to run
correctly with the autocrlf in any setting. If this is the case,
shouldn't the correct fix be to remove tests that are testing that
things work with different settings of autocrlf, because these tests
are effectively run by a full test suite run with autocrlf
alternatively set anyway?

-- 
Charles Bailey
http://ccgi.hashpling.plus.com/blog/

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 3/6] Fix tests to work with core.autocrlf=true
  2009-05-11 22:20       ` [PATCH 3/6] Fix tests to work with core.autocrlf=true Charles Bailey
@ 2009-05-14 13:49         ` Don Slutz
  0 siblings, 0 replies; 24+ messages in thread
From: Don Slutz @ 2009-05-14 13:49 UTC (permalink / raw)
  To: Charles Bailey; +Cc: git

On 5/11/2009 6:20 PM, Charles Bailey wrote:
> On Mon, May 11, 2009 at 03:28:58PM -0400, Don Slutz wrote:
>   
>> diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh
>> index e768c3e..bf39e45 100755
>> --- a/t/t7610-mergetool.sh
>> +++ b/t/t7610-mergetool.sh
>> @@ -45,9 +45,9 @@ test_expect_success 'custom mergetool' '
>>      ( yes "" | git mergetool file1 >/dev/null 2>&1 ) &&
>>      ( yes "" | git mergetool file2 >/dev/null 2>&1 ) &&
>>      ( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) &&
>> -    test "$(cat file1)" = "master updated" &&
>> -    test "$(cat file2)" = "master new" &&
>> -    test "$(cat subdir/file3)" = "master new sub" &&
>> +    test_cat_eq file1 "master updated" &&
>> +    test_cat_eq file2 "master new" &&
>> +    test_cat_eq subdir/file3 "master new sub" &&
>>      git commit -m "branch1 resolved with mergetool"
>>  '
>>     
>
> This change concerns me. At the moment, the mergetool test assumes
> that globally autocrlf is true and has further tests that attempt to
> verify its behaviour with autocrlf set to true.
Assuming that should have been false and then true for the setting of 
autocrlf.  I would say that
this code does not fully check for autocrlf=false.  For version 1 of the 
patch I did not look for
other tests that dis not include crlf in their name that had tests for 
changing autocrlf.
>  See the very next
> test:
>
> test_expect_success 'mergetool crlf' '
>     git config core.autocrlf true &&
>     git checkout -b test2 branch1
>     test_must_fail git merge master >/dev/null 2>&1 &&
>     ( yes "" | git mergetool file1 >/dev/null 2>&1 ) &&
>     ( yes "" | git mergetool file2 >/dev/null 2>&1 ) &&
>     ( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) &&
>     test "$(printf x | cat file1 -)" = "$(printf "master updated\r\nx")" &&
>     test "$(printf x | cat file2 -)" = "$(printf "master new\r\nx")" &&
>     test "$(printf x | cat subdir/file3 -)" = "$(printf "master new sub\r\nx")" &&
>     git commit -m "branch1 resolved with mergetool - autocrlf" &&
>     git config core.autocrlf false &&
>     git reset --hard
> '
>
> Does the resetting of core.autocrlf to false not break the subsequent
> tests?
>
>   
It does cause the subsequent tests to not be tested in autocrlf=true.  
However I have verified that the sequence:

git config core.autocrlf false && git reset --hard

Does not do what you might expect.  A "touch file1" can cause "git diff" 
to start reporting a difference!

Patch set v2 out soon.
   -Don



__________________________________________________________________________________________________________________
DISCLAIMER:"The information contained in this message and the attachments (if any) may be privileged and confidential and protected from disclosure. You are hereby notified that any unauthorized use, dissemination, distribution or copying of this communication, review, retransmission, or taking of any action based upon this information, by persons or entities other than the intended recipient, is strictly prohibited. If you are not the intended recipient or an employee or agent responsible for delivering this message, and have received this communication in error, please notify us immediately by replying to the message and kindly delete the original message, attachments, if any, and all its copies from your computer system. Thank you for your cooperation." 
________________________________________________________________________________________________________________

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH v2 3/7] Fix tests to work with core.autocrlf=true -- new functions
  2009-05-14  7:43         ` [PATCH v2 3/7] Fix tests to work with core.autocrlf=true -- new functions Charles Bailey
@ 2009-05-14 14:39           ` Don Slutz
  0 siblings, 0 replies; 24+ messages in thread
From: Don Slutz @ 2009-05-14 14:39 UTC (permalink / raw)
  To: Charles Bailey; +Cc: git

On 5/14/2009 3:43 AM, Charles Bailey wrote,

> On Wed, May 13, 2009 at 03:35:44PM -0400, Don Slutz wrote:
>   
>> Have I missed some previous recent discussion about this patch series?
>> I know that you referenced that long Aug 2007 thread about autocrlf,
>> but is there some more recent discussion about how the test suite
>> works / should work?
>>
>>     
Not that I have seen.  I did forget to send the previous reply, should 
now be there.
>> mergetool isn't the prime implementor of autocrlf, but it does have
>> some checks to make sure that it works with autocrlf. My impression -
>> probably incorrect - has been that autocrlf is off for the purposes of
>> building and testing git on all platforms, but that some packages
>> switch it on by default on install for user convenience on platforms
>> where this is appropriate.
>>
>> Your patch seems to be about allowing the entire test suite to run
>> correctly with the autocrlf in any setting. If this is the case,
>> shouldn't the correct fix be to remove tests that are testing that
>> things work with different settings of autocrlf, because these tests
>> are effectively run by a full test suite run with autocrlf
>> alternatively set anyway?
>>
>>     
Well my take is that most of the tests do not care about autocrlf, they 
are checking that the right file or error is happening.  For example:


   git commit -m "c1"
  echo foo >file2
  git checkout -- file2

just wants to know that file2 is correctly reverted to before the 
change.  The fact that file2 can have LF -> CRLF if autocrlf=true is not 
what is being checked for here.  There are several tests like 
t0020-crlf.sh that are checking that the right thing happens.

I am assuming that t7610-mergetool.sh add the test for autocrlf=true 
because of some issue (bug?) that was fixed.  However I have not done a 
full look into way the test is there.  I was focused on getting the 
tests to pass.

Also I do expect that most people will run the tests in the default mode 
only.  I have no plans on add the "run the tests in all possible 
settings of autocrlf".

This set seems like a subset (but still big) change on the path of 
getting git to work and pass the tests under CYGWIN on a text mount.  
That change is still in progress and not yet ready for the list.

   -Don


__________________________________________________________________________________________________________________
DISCLAIMER:"The information contained in this message and the attachments (if any) may be privileged and confidential and protected from disclosure. You are hereby notified that any unauthorized use, dissemination, distribution or copying of this communication, review, retransmission, or taking of any action based upon this information, by persons or entities other than the intended recipient, is strictly prohibited. If you are not the intended recipient or an employee or agent responsible for delivering this message, and have received this communication in error, please notify us immediately by replying to the message and kindly delete the original message, attachments, if any, and all its copies from your computer system. Thank you for your cooperation." 
________________________________________________________________________________________________________________

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2009-05-14 14:41 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-11 19:28 [PATCH 0/6] Add core.autocrlf=true on cygwin by default during tests Don Slutz
2009-05-11 19:28 ` [PATCH 1/6] " Don Slutz
2009-05-11 19:28   ` [PATCH 2/6] Fix tests to work with core.autocrlf=true Don Slutz
2009-05-11 19:28     ` [PATCH 3/6] " Don Slutz
2009-05-11 19:28       ` [PATCH 4/6] " Don Slutz
2009-05-11 19:29         ` [PATCH 5/6] " Don Slutz
2009-05-11 19:29           ` [PATCH 6/6] Add 'make test-text' Don Slutz
2009-05-11 22:20       ` [PATCH 3/6] Fix tests to work with core.autocrlf=true Charles Bailey
2009-05-14 13:49         ` Don Slutz
2009-05-11 20:04 ` [PATCH 0/6] Add core.autocrlf=true on cygwin by default during tests Eric Blake
2009-05-12 23:27   ` Junio C Hamano
2009-05-13 17:41     ` Junio C Hamano
2009-05-11 20:54 ` Johannes Schindelin
2009-05-12 18:16   ` Don Slutz
2009-05-13 19:35 ` [PATCH v2 0/7] Add GIT_TEST_AUTO_CRLF environment variable to set core.autocrlf on init Don Slutz
2009-05-13 19:35   ` [PATCH v2 1/7] " Don Slutz
2009-05-13 19:35     ` [PATCH v2 2/7] Add support functions for tests in core.autocrlf=true Don Slutz
2009-05-13 19:35       ` [PATCH v2 3/7] Fix tests to work with core.autocrlf=true -- new functions Don Slutz
2009-05-13 19:35         ` [PATCH v2 4/7] Fix tests to work with core.autocrlf=true -- force false Don Slutz
2009-05-13 19:35           ` [PATCH v2 5/7] Fix tests to work with core.autocrlf=true -- cmp to test_cmp Don Slutz
2009-05-13 19:35             ` [PATCH v2 6/7] Fix tests to work with core.autocrlf=true -- test_cmp to cmp Don Slutz
2009-05-13 19:35               ` [PATCH v2 7/7] Add 'make test-text' core.autocrlf=true Don Slutz
2009-05-14  7:43         ` [PATCH v2 3/7] Fix tests to work with core.autocrlf=true -- new functions Charles Bailey
2009-05-14 14:39           ` Don Slutz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).