[PATCH v2 1/7] Add GIT_TEST_AUTO_CRLF environment variable to set core.autocrlf on init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Normal usage:

GIT_TEST_AUTO_CRLF=true make test

Signed-off-by: Don Slutz <Don.Slutz@xxxxxxxxxxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]