[PATCH 1/6] Add core.autocrlf=true on cygwin by default during tests

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

 



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

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

--
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]