From acf70effc3ceece7d02c7569df1b39228ea9b2c7 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Thu, 28 Apr 2011 00:30:49 +0200 Subject: [PATCH 01/29] submodule: Fix t7400, t7405, t7406 for msysGit Again, avoid using echo (which issues DOS line endings on msysGit) to not mix with Unix line-endings issued by git built-ins, even if this is at the cost of calling an external executable (cat) instead of a shell built-in (echo). --- git-sh-setup.sh | 4 +++- git-submodule.sh | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/git-sh-setup.sh b/git-sh-setup.sh index fffa3c72d7..0099552b25 100644 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -59,7 +59,9 @@ GIT_QUIET= say () { if test -z "$GIT_QUIET" then - printf '%s\n' "$*" + cat < /dev/null 2>&1 then - eval_gettextln "The following path is ignored by one of your .gitignore files: -\$sm_path -Use -f if you really want to add it." >&2 + cat >&2 < Date: Fri, 23 Mar 2012 10:58:37 +0100 Subject: [PATCH 02/29] am: Use cat instead of echo to avoid DOS line-endings (fixes t4150) Along the lines of 05d0e3b and f33946d, use cat instead of echo to avoid line ending mismatches in the test result of "am empty-file does not infloop" which make the test fail. Signed-off-by: Sebastian Schuberth --- git-am.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/git-am.sh b/git-am.sh index e92e5bb121..6a00ccffb2 100755 --- a/git-am.sh +++ b/git-am.sh @@ -182,7 +182,9 @@ It does not apply to blobs recorded in its index.")" } clean_abort () { - test $# = 0 || echo >&2 "$@" + test $# = 0 || cat >&2 < Date: Thu, 8 Apr 2010 00:18:07 +0200 Subject: [PATCH 03/29] Work around funny CR issue This is really a problem with shell scripts being called on msysGit, but there are more important bugs to fix for the moment. Signed-off-by: Johannes Schindelin --- t/t7407-submodule-foreach.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/t/t7407-submodule-foreach.sh b/t/t7407-submodule-foreach.sh index 7ca10b8606..e42c70bed0 100755 --- a/t/t7407-submodule-foreach.sh +++ b/t/t7407-submodule-foreach.sh @@ -77,6 +77,10 @@ test_expect_success 'test basic "submodule foreach" usage' ' git config foo.bar zar && git submodule foreach "git config --file \"\$toplevel/.git/config\" foo.bar" ) && + if test_have_prereq MINGW + then + dos2unix actual + fi && test_i18ncmp expect actual ' @@ -174,6 +178,10 @@ test_expect_success 'test messages from "foreach --recursive"' ' cd clone2 && git submodule foreach --recursive "true" > ../actual ) && + if test_have_prereq MINGW + then + dos2unix actual + fi && test_i18ncmp expect actual ' @@ -192,6 +200,10 @@ test_expect_success 'test "foreach --quiet --recursive"' ' cd clone2 && git submodule foreach -q --recursive "echo \$name-\$path" > ../actual ) && + if test_have_prereq MINGW + then + dos2unix actual + fi && test_cmp expect actual ' @@ -239,6 +251,10 @@ test_expect_success 'test "status --recursive"' ' cd clone3 && git submodule status --recursive > ../actual ) && + if test_have_prereq MINGW + then + dos2unix actual + fi && test_cmp expect actual ' From de2638243ea5b8f3742e25abac8fb51a7c981f3d Mon Sep 17 00:00:00 2001 From: Heiko Voigt Date: Wed, 16 Jun 2010 20:11:00 +0200 Subject: [PATCH 04/29] work around misdetection of stdin attached to a tty Git on Windows was made aware of the fact that sometimes a file may be used by another process and so an operation may fail but the user might be able to fix it and is asking for confirmation whether it should retry. This is implemented in a way that git only asks in case stdin and stderr are attached to a tty. Unfortunately this seems to be misdetected sometimes causing the testsuite to hang when git is waiting for a user answer. This patch works around the situation. Signed-off-by: Heiko Voigt --- t/test-lib.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/t/test-lib.sh b/t/test-lib.sh index 3c7cb1d774..599b1ff2d9 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -15,6 +15,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see http://www.gnu.org/licenses/ . +# for git on windows so stdin will not be misdetected as attached to a +# terminal +exec < /dev/null + # Keep the original TERM for say_color ORIGINAL_TERM=$TERM From a30e6f8fdd52ac51e8bc5a7cb3ce5ee9342d4bdf Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sat, 8 Jan 2011 17:02:17 +0100 Subject: [PATCH 05/29] Handle new t1501 test case properly with MinGW Signed-off-by: Johannes Schindelin --- t/t1501-worktree.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh index 8f36aa9fc4..06982bddb7 100755 --- a/t/t1501-worktree.sh +++ b/t/t1501-worktree.sh @@ -339,6 +339,10 @@ test_expect_success 'make_relative_path handles double slashes in GIT_DIR' ' git --git-dir="$(pwd)//repo.git" --work-tree="$(pwd)" add dummy_file ' +test_have_prereq MINGW && +# make sure to test DOS path on Windows +TRASH_DIRECTORY="$(cd "$TRASH_DIRECTORY" && pwd)" + test_expect_success 'relative $GIT_WORK_TREE and git subprocesses' ' GIT_DIR=repo.git GIT_WORK_TREE=repo.git/work \ test-subprocess --setup-work-tree rev-parse --show-toplevel >actual && From b351af80edd1049784b33b40c55a737cde528e6a Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 1 Apr 2011 09:29:35 +0200 Subject: [PATCH 06/29] MinGW: Skip test redirecting to fd 4 ... because that does not work in MinGW. Signed-off-by: Johannes Schindelin --- t/t0081-line-buffer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t0081-line-buffer.sh b/t/t0081-line-buffer.sh index bd83ed371a..25dba008f3 100755 --- a/t/t0081-line-buffer.sh +++ b/t/t0081-line-buffer.sh @@ -29,7 +29,7 @@ test_expect_success '0-length read, send along greeting' ' test_cmp expect actual ' -test_expect_success 'read from file descriptor' ' +test_expect_success NOT_MINGW 'read from file descriptor' ' rm -f input && echo hello >expect && echo hello >input && From 5bf667bd878925a012e1e90049388ac208e3567f Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Tue, 26 Apr 2011 10:39:30 +0100 Subject: [PATCH 07/29] t3102: Windows filesystems may not use a literal asterisk in filenames. Exclude these tests when using MINGW. Signed-off-by: Pat Thoyts --- t/t3102-ls-tree-wildcards.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t3102-ls-tree-wildcards.sh b/t/t3102-ls-tree-wildcards.sh index c286854485..766af3de9b 100755 --- a/t/t3102-ls-tree-wildcards.sh +++ b/t/t3102-ls-tree-wildcards.sh @@ -4,14 +4,14 @@ test_description='ls-tree with(out) globs' . ./test-lib.sh -test_expect_success 'setup' ' +test_expect_success NOT_MINGW 'setup' ' mkdir a aa "a[a]" && touch a/one aa/two "a[a]/three" && git add a/one aa/two "a[a]/three" && git commit -m test ' -test_expect_success 'ls-tree a[a] matches literally' ' +test_expect_success NOT_MINGW 'ls-tree a* matches literally' ' cat >expected < Date: Sun, 1 May 2011 14:47:09 +0100 Subject: [PATCH 08/29] t5407: Fix line-ending dependency in post-rewrite.args On msysGit creating the post-rewrite.args file using 'echo' has different line endings from the expected comparison. Using perl normalizes the line endings for each generated file. Signed-off-by: Pat Thoyts --- t/t5407-post-rewrite-hook.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh index ea2e0d4b48..710c18bf90 100755 --- a/t/t5407-post-rewrite-hook.sh +++ b/t/t5407-post-rewrite-hook.sh @@ -20,9 +20,13 @@ test_expect_success 'setup' ' mkdir .git/hooks cat >.git/hooks/post-rewrite < "$TRASH_DIRECTORY"/post-rewrite.args -cat > "$TRASH_DIRECTORY"/post-rewrite.data +#!/usr/bin/perl +open (AR, ">$TRASH_DIRECTORY/post-rewrite.args"); +print AR \$_,"\n" foreach @ARGV; +open (DAT, ">$TRASH_DIRECTORY/post-rewrite.data"); +while() { + print DAT; +} EOF chmod u+x .git/hooks/post-rewrite From 35a078cad55d43aa3fb20d1a17bd169b6ef793bb Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 5 Jan 2012 17:55:00 -0600 Subject: [PATCH 09/29] t030[02]: work around CR/LF issue It is the old shell-script issue we had in a few other tests already. Signed-off-by: Johannes Schindelin --- t/lib-credential.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/t/lib-credential.sh b/t/lib-credential.sh index 957ae936e8..0c5ff70e19 100755 --- a/t/lib-credential.sh +++ b/t/lib-credential.sh @@ -19,6 +19,10 @@ check() { false fi && test_cmp expect-stdout stdout && + if test_have_prereq MINGW + then + dos2unix stderr + fi && test_cmp expect-stderr stderr } From acd984dfa0c7c8311f9af00de365e2b36bae58c5 Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Sun, 24 Jul 2011 15:54:04 +0200 Subject: [PATCH 10/29] t9350: point out that refs are not updated correctly This happens only when the corresponding commits are not exported in the current fast-export run. This can happen either when the relevant commit is already marked, or when the commit is explicitly marked as UNINTERESTING with a negative ref by another argument. This breaks fast-export basec remote helpers. Signed-off-by: Sverre Rabbelier --- t/t9350-fast-export.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh index 2312dec8f0..fe5181dbf8 100755 --- a/t/t9350-fast-export.sh +++ b/t/t9350-fast-export.sh @@ -504,4 +504,15 @@ test_expect_success 'refs are updated even if no commits need to be exported' ' test_cmp expected actual ' +cat > expected << EOF +reset refs/heads/master +from $(git rev-parse master) + +EOF + +test_expect_failure 'refs are updated even if no commits need to be exported' ' + git fast-export master..master > actual && + test_cmp expected actual +' + test_done From c3f9224acf7cfda8d4f10140e44e7845ce5037ee Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 9 Apr 2012 21:09:49 -0500 Subject: [PATCH 11/29] Windows: make sure that merge-octopus only outputs LF line endings This happens to shut up t7602 on Windows which would otherwise take the different line endings for a sign that the merge failed. Signed-off-by: Johannes Schindelin --- git-merge-octopus.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/git-merge-octopus.sh b/git-merge-octopus.sh index 8643f74cb0..2226eeba99 100755 --- a/git-merge-octopus.sh +++ b/git-merge-octopus.sh @@ -71,7 +71,9 @@ do case "$LF$common$LF" in *"$LF$SHA1$LF"*) - echo "Already up-to-date with $pretty_name" + cat << EOF +Already up-to-date with $pretty_name +EOF continue ;; esac @@ -83,7 +85,9 @@ do # tree as the intermediate result of the merge. # We still need to count this as part of the parent set. - echo "Fast-forwarding to: $pretty_name" + cat << EOF +Fast-forwarding to: $pretty_name +EOF git read-tree -u -m $head $SHA1 || exit MRC=$SHA1 MRT=$(git write-tree) continue @@ -91,7 +95,9 @@ do NON_FF_MERGE=1 - echo "Trying simple merge with $pretty_name" + cat << EOF +Trying simple merge with $pretty_name +EOF git read-tree -u -m --aggressive $common $MRT $SHA1 || exit 2 next=$(git write-tree 2>/dev/null) if test $? -ne 0 From 8d0429ca41de08ee9196afc41bcc41bf1ecc5db6 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 19 Apr 2012 18:21:29 -0500 Subject: [PATCH 12/29] Introduce and use test_cmp_text On Windows, we suffer from frequently leaked DOS line endings. Let's ignore them. Signed-off-by: Johannes Schindelin --- t/lib-credential.sh | 6 +----- t/t9001-send-email.sh | 30 +++++++++++++++--------------- t/test-lib.sh | 14 +++++++++++++- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/t/lib-credential.sh b/t/lib-credential.sh index 0c5ff70e19..9d78da223f 100755 --- a/t/lib-credential.sh +++ b/t/lib-credential.sh @@ -19,11 +19,7 @@ check() { false fi && test_cmp expect-stdout stdout && - if test_have_prereq MINGW - then - dos2unix stderr - fi && - test_cmp expect-stderr stderr + test_cmp_text expect-stderr stderr } read_chunk() { diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 3119c8c523..d680aa6313 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -96,7 +96,7 @@ EOF test_expect_success $PREREQ \ 'Verify commandline' \ - 'test_cmp expected commandline1' + 'test_cmp_text expected commandline1' test_expect_success $PREREQ 'Send patches with --envelope-sender' ' clean_fake_sendmail && @@ -116,7 +116,7 @@ EOF test_expect_success $PREREQ \ 'Verify commandline' \ - 'test_cmp expected commandline1' + 'test_cmp_text expected commandline1' test_expect_success $PREREQ 'Send patches with --envelope-sender=auto' ' clean_fake_sendmail && @@ -136,7 +136,7 @@ EOF test_expect_success $PREREQ \ 'Verify commandline' \ - 'test_cmp expected commandline1' + 'test_cmp_text expected commandline1' test_expect_success $PREREQ 'setup expect' " cat >expected-show-all-headers <<\EOF @@ -260,7 +260,7 @@ test_expect_success $PREREQ 'Show all headers' ' -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \ -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \ >actual-show-all-headers && - test_cmp expected-show-all-headers actual-show-all-headers + test_cmp_text expected-show-all-headers actual-show-all-headers ' test_expect_success $PREREQ 'Prompting works' ' @@ -428,13 +428,13 @@ test_expect_success $PREREQ 'In-Reply-To without --chain-reply-to' ' 2>errors && # The first message is a reply to --in-reply-to sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual && - test_cmp expect actual && + test_cmp_text expect actual && # Second and subsequent messages are replies to the first one sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt1 >expect && sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt2 >actual && - test_cmp expect actual && + test_cmp_text expect actual && sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt3 >actual && - test_cmp expect actual + test_cmp_text expect actual ' test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' ' @@ -449,13 +449,13 @@ test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' ' $patches $patches $patches \ 2>errors && sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual && - test_cmp expect actual && + test_cmp_text expect actual && sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt1 >expect && sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt2 >actual && - test_cmp expect actual && + test_cmp_text expect actual && sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt2 >expect && sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt3 >actual && - test_cmp expect actual + test_cmp_text expect actual ' test_expect_success $PREREQ 'setup fake editor' ' @@ -527,7 +527,7 @@ test_suppression () { -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \ -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \ >actual-suppress-$1${2+"-$2"} && - test_cmp expected-suppress-$1${2+"-$2"} actual-suppress-$1${2+"-$2"} + test_cmp_text expected-suppress-$1${2+"-$2"} actual-suppress-$1${2+"-$2"} } test_expect_success $PREREQ 'sendemail.cc set' ' @@ -1243,7 +1243,7 @@ test_expect_success $PREREQ 'asks about and fixes 8bit encodings' ' grep email-using-8bit stdout && grep "Which 8bit encoding" stdout && egrep "Content|MIME" msgtxt1 >actual && - test_cmp actual content-type-decl + test_cmp_text actual content-type-decl ' test_expect_success $PREREQ 'sendemail.8bitEncoding works' ' @@ -1254,7 +1254,7 @@ test_expect_success $PREREQ 'sendemail.8bitEncoding works' ' --smtp-server="$(pwd)/fake.sendmail" \ email-using-8bit >stdout && egrep "Content|MIME" msgtxt1 >actual && - test_cmp actual content-type-decl + test_cmp_text actual content-type-decl ' test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' ' @@ -1266,7 +1266,7 @@ test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' ' --8bit-encoding=UTF-8 \ email-using-8bit >stdout && egrep "Content|MIME" msgtxt1 >actual && - test_cmp actual content-type-decl + test_cmp_text actual content-type-decl ' test_expect_success $PREREQ 'setup expect' ' @@ -1295,7 +1295,7 @@ test_expect_success $PREREQ '--8bit-encoding also treats subject' ' --8bit-encoding=UTF-8 \ email-using-8bit >stdout && grep "Subject" msgtxt1 >actual && - test_cmp expected actual + test_cmp_text expected actual ' # Note that the patches in this test are deliberately out of order; we diff --git a/t/test-lib.sh b/t/test-lib.sh index 599b1ff2d9..d5abf0f4fd 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -791,12 +791,24 @@ else test_set_prereq C_LOCALE_OUTPUT fi +# Use this instead of test_cmp to compare files that are expected to contain +# text (and therefore it should not matter whether the line ends in an LF or +# a CR/LF). +test_cmp_text () { + if test_have_prereq MINGW + then + dos2unix "$1" && + dos2unix "$2" + fi && + test_cmp "$@" +} + # Use this instead of test_cmp to compare files that contain expected and # actual output from git commands that can be translated. When running # under GETTEXT_POISON this pretends that the command produced expected # results. test_i18ncmp () { - test -n "$GETTEXT_POISON" || test_cmp "$@" + test -n "$GETTEXT_POISON" || test_cmp_text "$@" } # Use this instead of "grep expected-string actual" to see if the From 58ecd42a0371cdc61852e6a890615033d0ed4beb Mon Sep 17 00:00:00 2001 From: Karsten Blees Date: Sat, 20 Aug 2011 14:27:02 +0200 Subject: [PATCH 13/29] MinGW: disable legacy encoding tests On Windows, all native APIs are Unicode-based. It is impossible to pass legacy encoded byte arrays to a process via command line or environment variables. Disable the tests that try to do so. In t3901, most tests still work if we don't mess up the repository encoding in setup, so don't switch to ISO-8859-1 on MinGW. Note that i18n tests that do their encoding tricks via encoded files (such as t3900) are not affected by this. Signed-off-by: Karsten Blees --- t/t3901-i18n-patch.sh | 19 +++++++++++-------- t/t4201-shortlog.sh | 6 +++--- t/t8005-blame-i18n.sh | 8 ++++---- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/t/t3901-i18n-patch.sh b/t/t3901-i18n-patch.sh index 31a5770b34..55c8a2f576 100755 --- a/t/t3901-i18n-patch.sh +++ b/t/t3901-i18n-patch.sh @@ -54,10 +54,13 @@ test_expect_success setup ' git add yours && git commit -s -m "Second on side" && - # the second one on the side branch is ISO-8859-1 - git config i18n.commitencoding ISO8859-1 && - # use author and committer name in ISO-8859-1 to match it. - . "$TEST_DIRECTORY"/t3901-8859-1.txt && + if test_have_prereq NOT_MINGW + then + # the second one on the side branch is ISO-8859-1 + git config i18n.commitencoding ISO8859-1 && + # use author and committer name in ISO-8859-1 to match it. + . "$TEST_DIRECTORY"/t3901-8859-1.txt + fi && test_tick && echo Yet another >theirs && git add theirs && @@ -119,7 +122,7 @@ test_expect_success 'rebase (U/L)' ' check_encoding 2 ' -test_expect_success 'rebase (L/L)' ' +test_expect_success NOT_MINGW 'rebase (L/L)' ' # In this test we want ISO-8859-1 encoded commits as the result git config i18n.commitencoding ISO8859-1 && git config i18n.logoutputencoding ISO8859-1 && @@ -131,7 +134,7 @@ test_expect_success 'rebase (L/L)' ' check_encoding 2 8859 ' -test_expect_success 'rebase (L/U)' ' +test_expect_success NOT_MINGW 'rebase (L/U)' ' # This is pathological -- use UTF-8 as intermediate form # to get ISO-8859-1 results. git config i18n.commitencoding ISO8859-1 && @@ -159,7 +162,7 @@ test_expect_success 'cherry-pick(U/U)' ' check_encoding 3 ' -test_expect_success 'cherry-pick(L/L)' ' +test_expect_success NOT_MINGW 'cherry-pick(L/L)' ' # Both the commitencoding and logoutputencoding is set to ISO-8859-1 git config i18n.commitencoding ISO8859-1 && @@ -189,7 +192,7 @@ test_expect_success 'cherry-pick(U/L)' ' check_encoding 3 ' -test_expect_success 'cherry-pick(L/U)' ' +test_expect_success NOT_MINGW 'cherry-pick(L/U)' ' # Again, the commitencoding is set to ISO-8859-1 but # logoutputencoding is set to UTF-8. diff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh index 42866992cf..a1db6fb4ae 100755 --- a/t/t4201-shortlog.sh +++ b/t/t4201-shortlog.sh @@ -93,7 +93,7 @@ test_expect_success 'output from user-defined format is re-wrapped' ' test_cmp expect log.predictable ' -test_expect_success 'shortlog wrapping' ' +test_expect_success NOT_MINGW 'shortlog wrapping' ' cat >expect <<\EOF && A U Thor (5): Test @@ -114,7 +114,7 @@ EOF test_cmp expect out ' -test_expect_success 'shortlog from non-git directory' ' +test_expect_success NOT_MINGW 'shortlog from non-git directory' ' git log HEAD >log && GIT_DIR=non-existing git shortlog -w out && test_cmp expect out @@ -159,7 +159,7 @@ $DSCHO (2): EOF -test_expect_success 'shortlog encoding' ' +test_expect_success NOT_MINGW 'shortlog encoding' ' git reset --hard "$commit" && git config --unset i18n.commitencoding && echo 2 > a1 && diff --git a/t/t8005-blame-i18n.sh b/t/t8005-blame-i18n.sh index cb390559f9..a6e73d0635 100755 --- a/t/t8005-blame-i18n.sh +++ b/t/t8005-blame-i18n.sh @@ -33,7 +33,7 @@ author $SJIS_NAME summary $SJIS_MSG EOF -test_expect_success \ +test_expect_success NOT_MINGW \ 'blame respects i18n.commitencoding' ' git blame --incremental file | \ egrep "^(author|summary) " > actual && @@ -49,7 +49,7 @@ author $EUC_JAPAN_NAME summary $EUC_JAPAN_MSG EOF -test_expect_success \ +test_expect_success NOT_MINGW \ 'blame respects i18n.logoutputencoding' ' git config i18n.logoutputencoding eucJP && git blame --incremental file | \ @@ -66,7 +66,7 @@ author $UTF8_NAME summary $UTF8_MSG EOF -test_expect_success \ +test_expect_success NOT_MINGW \ 'blame respects --encoding=UTF-8' ' git blame --incremental --encoding=UTF-8 file | \ egrep "^(author|summary) " > actual && @@ -82,7 +82,7 @@ author $UTF8_NAME summary $UTF8_MSG EOF -test_expect_success \ +test_expect_success NOT_MINGW \ 'blame respects --encoding=none' ' git blame --incremental --encoding=none file | \ egrep "^(author|summary) " > actual && From d917934b5861f0a369b7744f00aee5170d31c14d Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 23 May 2012 14:51:45 -0500 Subject: [PATCH 14/29] t1050: Fix invalid call to dd(1) This is a companion patch to fce52b4(t4012: Fix invalid call to dd(1)). Signed-off-by: Johannes Schindelin --- t/t1050-large.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/t/t1050-large.sh b/t/t1050-large.sh index fd10528009..76ca151578 100755 --- a/t/t1050-large.sh +++ b/t/t1050-large.sh @@ -9,10 +9,10 @@ test_expect_success setup ' # clone does not allow us to pass core.bigfilethreshold to # new repos, so set core.bigfilethreshold globally git config --global core.bigfilethreshold 200k && - echo X | dd of=large1 bs=1k seek=2000 && - echo X | dd of=large2 bs=1k seek=2000 && - echo X | dd of=large3 bs=1k seek=2000 && - echo Y | dd of=huge bs=1k seek=2500 && + perl -e "print \"\\0\" x 2048000; print \"X\\n\";" > large1 && + perl -e "print \"\\0\" x 2048000; print \"X\\n\";" > large2 && + perl -e "print \"\\0\" x 2048000; print \"X\\n\";" > large3 && + perl -e "print \"\\0\" x 2560000; print \"Y\\n\";" > huge && GIT_ALLOC_LIMIT=1500 && export GIT_ALLOC_LIMIT ' From a3bcb59e99fccc8a7b1a459f1495fd880c2eeec8 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 28 May 2012 19:58:50 -0500 Subject: [PATCH 15/29] Work around a problem identified by BuildHive Apparently the signal handling is not quite correct in the fsckobject handling (most likely we rely on a side effect that lets us still output some message after receiving a signal 13 but in the BuildHive setup this fails intermittently). As a consequence, the push in t5504 does fail as expected, but fails to output anything (unexpected). Since this is good enough for now, let's handle an empty output as success, too. Signed-off-by: Johannes Schindelin --- t/t5504-fetch-receive-strict.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t5504-fetch-receive-strict.sh b/t/t5504-fetch-receive-strict.sh index 69ee13c8be..bb8bc94bfc 100755 --- a/t/t5504-fetch-receive-strict.sh +++ b/t/t5504-fetch-receive-strict.sh @@ -101,7 +101,7 @@ test_expect_success 'push with receive.fsckobjects' ' git config transfer.fsckobjects false ) && test_must_fail git push --porcelain dst master:refs/heads/test >act && - test_cmp exp act + test_cmp exp act || test ! -s act ' test_expect_success 'push with transfer.fsckobjects' ' @@ -112,7 +112,7 @@ test_expect_success 'push with transfer.fsckobjects' ' git config transfer.fsckobjects true ) && test_must_fail git push --porcelain dst master:refs/heads/test >act && - test_cmp exp act + test_cmp exp act || test ! -s act ' test_done From b15d6dc168ac20901525e178b9e5a551eb370141 Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Fri, 28 Sep 2012 11:30:56 +0100 Subject: [PATCH 16/29] t1306: perform file comparisons using text mode for Windows support Signed-off-by: Pat Thoyts --- t/t1306-xdg-files.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t1306-xdg-files.sh b/t/t1306-xdg-files.sh index 8b14ab187c..278fdd51f2 100755 --- a/t/t1306-xdg-files.sh +++ b/t/t1306-xdg-files.sh @@ -15,7 +15,7 @@ test_expect_success 'read config: xdg file exists and ~/.gitconfig doesn'\''t' ' echo " myalias = !echo in_config" >>.config/git/config && echo in_config >expected && git myalias >actual && - test_cmp expected actual + test_cmp_text expected actual ' @@ -25,7 +25,7 @@ test_expect_success 'read config: xdg file exists and ~/.gitconfig exists' ' echo " myalias = !echo in_gitconfig" >>.gitconfig && echo in_gitconfig >expected && git myalias >actual && - test_cmp expected actual + test_cmp_text expected actual ' From 4a70c2b0e3af04fe4bd36e769215a8769fb4e4d4 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 4 Dec 2012 00:17:45 -0600 Subject: [PATCH 17/29] Fix t3404 for Windows The usual problem: CR/LF... Signed-off-by: Johannes Schindelin --- t/t3404-rebase-interactive.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 50e22b1cad..8f4c16d765 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -817,7 +817,7 @@ test_expect_success 'running "git rebase -i --exec git show HEAD"' ' git rebase -i HEAD~2 >expect ) && sed -e "1,9d" expect >expected && - test_cmp expected actual + test_cmp_text expected actual ' @@ -831,7 +831,7 @@ test_expect_success 'running "git rebase --exec git show HEAD -i"' ' git rebase -i HEAD~2 >expect ) && sed -e "1,9d" expect >expected && - test_cmp expected actual + test_cmp_text expected actual ' @@ -845,7 +845,7 @@ test_expect_success 'running "git rebase -ix git show HEAD"' ' git rebase -i HEAD~2 >expect ) && sed -e "1,9d" expect >expected && - test_cmp expected actual + test_cmp_text expected actual ' @@ -859,7 +859,7 @@ test_expect_success 'rebase -ix with several ' ' git rebase -i HEAD~2 >expect ) && sed -e "1,9d" expect >expected && - test_cmp expected actual + test_cmp_text expected actual ' @@ -874,7 +874,7 @@ test_expect_success 'rebase -ix with several instances of --exec' ' git rebase -i HEAD~2 >expect ) && sed -e "1,11d" expect >expected && - test_cmp expected actual + test_cmp_text expected actual ' @@ -900,7 +900,7 @@ test_expect_success 'rebase -ix with --autosquash' ' git rebase -i HEAD~4 >expect ) && sed -e "1,13d" expect >expected && - test_cmp expected actual + test_cmp_text expected actual ' @@ -919,7 +919,7 @@ test_expect_success 'rebase -i --exec without ' ' test_must_fail git rebase -i --exec 2>tmp && sed -e "1d" tmp >actual && test_must_fail git rebase -h >expected && - test_cmp expected actual && + test_cmp_text expected actual && git checkout master ' From b530e4bf3988e4e2e0fe39105fe9f6418affc128 Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Thu, 30 May 2013 13:24:48 +0100 Subject: [PATCH 18/29] t0008: avoid absolute path on Windows as colon is used in the tests The test separator char is a colon which means any absolute paths on windows confuse the tests that use global_excludes. Suggested-by: Karsten Blees Signed-off-by: Pat Thoyts --- t/t0008-ignores.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh index b4d98e602f..d14a549a8f 100755 --- a/t/t0008-ignores.sh +++ b/t/t0008-ignores.sh @@ -5,7 +5,13 @@ test_description=check-ignore . ./test-lib.sh init_vars () { - global_excludes="$(pwd)/global-excludes" + # On Windows, avoid using "C:" in the global-excludes paths. + if test_have_prereq MINGW + then + global_excludes="global-excludes" + else + global_excludes="$(pwd)/global-excludes" + fi } enable_global_excludes () { From d813621f8dcded288d98240d6dc16e9e2cbb6ada Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Fri, 31 May 2013 10:58:25 +0100 Subject: [PATCH 19/29] t7800: a few tests should ignore crlf in checking the result. Those tests that generate files using echo can expect crlf issues when run under windows. For such cases we use 'test_cmp_text'. Signed-off-by: Pat Thoyts --- t/t7800-difftool.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh index 5a193c500d..78b12ad21e 100755 --- a/t/t7800-difftool.sh +++ b/t/t7800-difftool.sh @@ -253,7 +253,7 @@ test_expect_success PERL 'difftool --extcmd echo arg1' ' echo file >expect && git difftool --no-prompt \ --extcmd sh\ -c\ \"echo\ \$1\" branch >actual && - test_cmp expect actual + test_cmp_text expect actual ' test_expect_success PERL 'difftool --extcmd cat arg1' ' @@ -394,14 +394,14 @@ run_dir_diff_test 'difftool --dir-diff syncs worktree with unstaged change' ' echo "orig content" >file && git difftool -d $symlinks --extcmd "$(pwd)/modify-right-file" branch && echo "new content" >expect && - test_cmp expect file + test_cmp_text expect file ' run_dir_diff_test 'difftool --dir-diff syncs worktree without unstaged change' ' test_when_finished git reset --hard && git difftool -d $symlinks --extcmd "$(pwd)/modify-right-file" branch && echo "new content" >expect && - test_cmp expect file + test_cmp_text expect file ' write_script modify-file <<\EOF @@ -412,7 +412,7 @@ test_expect_success PERL 'difftool --no-symlinks does not overwrite working tree echo "orig content" >file && git difftool --dir-diff --no-symlinks --extcmd "$(pwd)/modify-file" branch && echo "new content" >expect && - test_cmp expect file + test_cmp_text expect file ' write_script modify-both-files <<\EOF @@ -428,9 +428,9 @@ test_expect_success PERL 'difftool --no-symlinks detects conflict ' ' echo "orig content" >file && test_must_fail git difftool --dir-diff --no-symlinks --extcmd "$(pwd)/modify-both-files" branch && echo "wt content" >expect && - test_cmp expect file && + test_cmp_text expect file && echo "tmp content" >expect && - test_cmp expect "$(cat tmpdir)/file" + test_cmp_text expect "$(cat tmpdir)/file" ) ' From 5c2060439b227b3fa919d1f0fa0d680b7d868f16 Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Sat, 1 Jun 2013 10:37:37 +0100 Subject: [PATCH 20/29] t4210: skip command-line encoding tests on mingw On Windows the application command line is provided as unicode and in mingw-git we convert that to utf-8. So these tests that require a iso-8859-1 input are being subverted by the encoding transformations we perform and should be skipped. Signed-off-by: Pat Thoyts --- t/t4210-log-i18n.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t4210-log-i18n.sh b/t/t4210-log-i18n.sh index 52a74729ba..9110404e55 100755 --- a/t/t4210-log-i18n.sh +++ b/t/t4210-log-i18n.sh @@ -34,7 +34,7 @@ test_expect_success 'log --grep searches in log output encoding (utf8)' ' test_cmp expect actual ' -test_expect_success 'log --grep searches in log output encoding (latin1)' ' +test_expect_success NOT_MINGW 'log --grep searches in log output encoding (latin1)' ' cat >expect <<-\EOF && latin1 utf8 @@ -43,7 +43,7 @@ test_expect_success 'log --grep searches in log output encoding (latin1)' ' test_cmp expect actual ' -test_expect_success 'log --grep does not find non-reencoded values (utf8)' ' +test_expect_success NOT_MINGW 'log --grep does not find non-reencoded values (utf8)' ' >expect && git log --encoding=utf8 --format=%s --grep=$latin1_e >actual && test_cmp expect actual From b5dde949bbbee8287b7811a72dc5e2f4312b65ff Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Tue, 27 Aug 2013 23:24:59 +0100 Subject: [PATCH 21/29] t7102: do not assume the system encoding is utf-8 The commit_msg function has an assumption that the string is being output as utf-8. On Windows this is not true so always convert from the system encoding to the desired encoding. Signed-off-by: Pat Thoyts --- t/t7102-reset.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index ee117e2e72..9874e45c5e 100755 --- a/t/t7102-reset.sh +++ b/t/t7102-reset.sh @@ -16,7 +16,7 @@ commit_msg () { msg="modify 2nd file (ge\303\244ndert)\n" if test -n "$1" then - printf "$msg" | iconv -f utf-8 -t "$1" + printf "$msg" | iconv -t "$1" else printf "$msg" fi @@ -60,7 +60,7 @@ check_changes () { test_expect_success 'reset --hard message' ' hex=$(git log -1 --format="%h") && git reset --hard > .actual && - echo HEAD is now at $hex $(commit_msg) > .expected && + echo HEAD is now at $hex $(commit_msg utf-8) > .expected && test_cmp .expected .actual ' From 6d5ddafd3748a7427068a57ed8f8f0ab6e8753a4 Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Mon, 2 Sep 2013 15:44:54 +0100 Subject: [PATCH 22/29] t6006: be explicit about the encoding of test strings for msysgit Signed-off-by: Pat Thoyts --- t/t6006-rev-list-format.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh index 98744038ec..07cd8e5f0b 100755 --- a/t/t6006-rev-list-format.sh +++ b/t/t6006-rev-list-format.sh @@ -22,13 +22,15 @@ test_expect_success 'setup' ' : >foo && git add foo && git config i18n.commitEncoding iso8859-1 && - git commit -m "$added_iso88591" && + echo "$added_iso88591" > commit-msg && + git commit -F commit-msg && head1=$(git rev-parse --verify HEAD) && head1_short=$(git rev-parse --verify --short $head1) && tree1=$(git rev-parse --verify HEAD:) && tree1_short=$(git rev-parse --verify --short $tree1) && echo "$changed" > foo && - git commit -a -m "$changed_iso88591" && + echo "$changed_iso88591" > commit-msg && + git commit -a -F commit-msg && head2=$(git rev-parse --verify HEAD) && head2_short=$(git rev-parse --verify --short $head2) && tree2=$(git rev-parse --verify HEAD:) && @@ -206,13 +208,12 @@ test_expect_success '%C(auto) respects --color=auto (stdout not tty)' ' ) ' -iconv -f utf-8 -t iso8859-1 > commit-msg < commit-msg test_expect_success 'setup complex body' ' git config i18n.commitencoding iso8859-1 && From 4de45ba540372d2e9051787e883eff0ab390f4c4 Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Mon, 2 Sep 2013 16:07:46 +0100 Subject: [PATCH 23/29] t4205: use a file to ensure the encoding is as desired with msysgit Signed-off-by: Pat Thoyts --- t/t4205-log-pretty-formats.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh index 2a6278bb33..ca532d36d2 100755 --- a/t/t4205-log-pretty-formats.sh +++ b/t/t4205-log-pretty-formats.sh @@ -28,7 +28,8 @@ test_expect_success 'set up basic repos' ' git add foo && test_tick && git config i18n.commitEncoding iso8859-1 && - git commit -m "$(commit_msg iso8859-1)" && + commit_msg iso8859-1 > commit_msg && + git commit --file commit_msg && git add bar && test_tick && git commit -m "add bar" && From 701cc0b0e43abc5e290b979b77c19a950cdb1be0 Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Mon, 2 Sep 2013 16:08:23 +0100 Subject: [PATCH 24/29] t4041: ensure the utf-8 encoded string really gets stored as utf-8. Signed-off-by: Pat Thoyts --- t/t4041-diff-submodule-option.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh index 1751c83307..306b233e27 100755 --- a/t/t4041-diff-submodule-option.sh +++ b/t/t4041-diff-submodule-option.sh @@ -13,7 +13,7 @@ This test tries to verify the sanity of the --submodule option of git diff. # String "added" in German (translated with Google Translate), encoded in UTF-8, # used in sample commit log messages in add_file() function below. -added=$(printf "hinzugef\303\274gt") +added=$(printf "hinzugef\303\274gt" | iconv -t utf-8) add_file () { ( cd "$1" && From 0b45d85e80f0a2efc05b3a0151a2ed017e77b176 Mon Sep 17 00:00:00 2001 From: Karsten Blees Date: Tue, 10 Sep 2013 13:50:19 -0500 Subject: [PATCH 25/29] t800[12]: work around MSys limitation MSys works very hard to convert Unix-style paths into DOS-style ones. *Very* hard. So hard, indeed, that git blame -L/hello/,/green/ is translated into something like git blame -LC:/msysgit/hello/,C:/msysgit/green/ As seen in msys_p2w in src\msys\msys\rt\src\winsup\cygwin\path.cc, line 3204ff: case '-': // // here we check for POSIX paths as attributes to a POSIX switch. // ... seemingly absolute POSIX paths in single-letter options get expanded by msys.dll unless they contain '=' or ';'. So a quick and very dirty fix is to use '-L/;*evil/'. (Using an equal sign works only when it is before a comma, so in the above example, /=*green/ would still be converted to a DOS-style path.) Commit-message-by: Johannes Schindelin Signed-off-by: Johannes Schindelin --- t/annotate-tests.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh index 304c7b7d87..4039723927 100644 --- a/t/annotate-tests.sh +++ b/t/annotate-tests.sh @@ -251,27 +251,27 @@ test_expect_success 'blame -L X,-N' ' ' test_expect_success 'blame -L /RE/ (RE to end)' ' - check_count -L/evil/ C 1 "A U Thor" 1 + check_count -L/\;*evil/ C 1 "A U Thor" 1 ' test_expect_success 'blame -L /RE/,/RE2/' ' - check_count -L/robot/,/green/ A 1 B 1 B2 1 D 1 E 1 + check_count -L/\;*robot/,/\;*green/ A 1 B 1 B2 1 D 1 E 1 ' test_expect_success 'blame -L X,/RE/' ' - check_count -L5,/evil/ B1 1 D 1 "A U Thor" 1 + check_count -L5,/\;*evil/ B1 1 D 1 "A U Thor" 1 ' test_expect_success 'blame -L /RE/,Y' ' - check_count -L/99/,7 B1 1 D 1 "A U Thor" 1 + check_count -L/\;*99/,7 B1 1 D 1 "A U Thor" 1 ' test_expect_success 'blame -L /RE/,+N' ' - check_count -L/99/,+3 B1 1 D 1 "A U Thor" 1 + check_count -L/\;*99/,+3 B1 1 D 1 "A U Thor" 1 ' test_expect_success 'blame -L /RE/,-N' ' - check_count -L/99/,-3 B 1 B2 1 D 1 + check_count -L/\;*99/,-3 B 1 B2 1 D 1 ' # 'file' ends with an incomplete line, so 'wc' reports one fewer lines than @@ -337,19 +337,19 @@ test_expect_success 'blame -L multiple (superset/subset: unordered)' ' ' test_expect_success 'blame -L /RE/ (relative)' ' - check_count -L3,3 -L/fox/ B1 1 B2 1 C 1 D 1 "A U Thor" 1 + check_count -L3,3 -L/\;*fox/ B1 1 B2 1 C 1 D 1 "A U Thor" 1 ' test_expect_success 'blame -L /RE/ (relative: no preceding range)' ' - check_count -L/dog/ A 1 B 1 B1 1 B2 1 C 1 D 1 "A U Thor" 1 + check_count -L/\;*dog/ A 1 B 1 B1 1 B2 1 C 1 D 1 "A U Thor" 1 ' test_expect_success 'blame -L /RE/ (relative: adjacent)' ' - check_count -L1,1 -L/dog/,+1 A 1 E 1 + check_count -L1,1 -L/\;*dog/,+1 A 1 E 1 ' test_expect_success 'blame -L /RE/ (relative: not found)' ' - test_must_fail $PROG -L4,4 -L/dog/ file + test_must_fail $PROG -L4,4 -L/\;*dog/ file ' test_expect_success 'blame -L /RE/ (relative: end-of-file)' ' @@ -357,11 +357,11 @@ test_expect_success 'blame -L /RE/ (relative: end-of-file)' ' ' test_expect_success 'blame -L ^/RE/ (absolute)' ' - check_count -L3,3 -L^/dog/,+2 A 1 B2 1 + check_count -L3,3 -L^/\;*dog/,+2 A 1 B2 1 ' test_expect_success 'blame -L ^/RE/ (absolute: no preceding range)' ' - check_count -L^/dog/,+2 A 1 B2 1 + check_count -L^/\;*dog/,+2 A 1 B2 1 ' test_expect_success 'blame -L ^/RE/ (absolute: not found)' ' From 9da68ecd8e540fd10d787f28d3ff8b82291e67c0 Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Mon, 2 Sep 2013 21:37:42 +0100 Subject: [PATCH 26/29] t9902: mingw-specific fix for gitfile link files The path in a .git platform independent link file needs to be absolute and under mingw we need it to be a windows type path, not a unix style path so it should start with a drive letter and not a /. Signed-off-by: Pat Thoyts --- t/t9902-completion.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 2d4beb5e50..e3319c8592 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -212,9 +212,18 @@ test_expect_success '__gitdir - non-existing $GIT_DIR' ' ) ' +function pwd_P_W () { + if test_have_prereq MINGW + then + pwd -W + else + pwd -P + fi +} + test_expect_success '__gitdir - gitfile in cwd' ' - echo "$(pwd -P)/otherrepo/.git" >expected && - echo "gitdir: $TRASH_DIRECTORY/otherrepo/.git" >subdir/.git && + echo "$(pwd_P_W)/otherrepo/.git" >expected && + echo "gitdir: $(pwd_P_W)/otherrepo/.git" >subdir/.git && test_when_finished "rm -f subdir/.git" && ( cd subdir && @@ -224,8 +233,8 @@ test_expect_success '__gitdir - gitfile in cwd' ' ' test_expect_success '__gitdir - gitfile in parent' ' - echo "$(pwd -P)/otherrepo/.git" >expected && - echo "gitdir: $TRASH_DIRECTORY/otherrepo/.git" >subdir/.git && + echo "$(pwd_P_W)/otherrepo/.git" >expected && + echo "gitdir: $(pwd_P_W)/otherrepo/.git" >subdir/.git && test_when_finished "rm -f subdir/.git" && ( cd subdir/subsubdir && From 9f79ea3b0ef1b8abda26e1dd851e800236f9f15d Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Mon, 26 Nov 2012 00:24:00 +0000 Subject: [PATCH 27/29] Push the NATIVE_CRLF Makefile variable to C and added a test for native. Commit 95f31e9a correctly points out that the NATIVE_CRLF setting is incorrectly set on Mingw git. However, the Makefile variable is not propagated to the C preprocessor and results in no change. This patch pushes the definition to the C code and adds a test to validate that when core.eol as native is crlf, we actually normalize text files to this line ending convention when core.autocrlf is false. Signed-off-by: Pat Thoyts --- Makefile | 3 +++ t/t0026-eol-config.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/Makefile b/Makefile index 33aa15b0e3..43c3565141 100644 --- a/Makefile +++ b/Makefile @@ -1479,6 +1479,9 @@ ifdef NO_REGEX COMPAT_CFLAGS += -Icompat/regex COMPAT_OBJS += compat/regex/regex.o endif +ifdef NATIVE_CRLF + BASIC_CFLAGS += -DNATIVE_CRLF +endif ifdef USE_NED_ALLOCATOR COMPAT_CFLAGS += -Icompat/nedmalloc diff --git a/t/t0026-eol-config.sh b/t/t0026-eol-config.sh index fe0164be62..a524f046b9 100755 --- a/t/t0026-eol-config.sh +++ b/t/t0026-eol-config.sh @@ -8,6 +8,20 @@ has_cr() { tr '\015' Q <"$1" | grep Q >/dev/null } +# core.eol crlf and core.autocrlf input are not permitted. +# this lets us check for the core.eol native being crlf. +set_native_eol_prereq() { + rm -rf eol && mkdir eol && + ( cd eol && + git init --quiet && + git config core.autocrlf input && + git config core.eol native && + git var core.eol 2> /dev/null + ) || + test_set_prereq NATIVE_EOL_IS_CRLF +} +set_native_eol_prereq + test_expect_success setup ' git config core.autocrlf false && @@ -80,4 +94,22 @@ test_expect_success 'autocrlf=true overrides unset eol' ' test -z "$onediff" -a -z "$twodiff" ' +test_expect_success NATIVE_EOL_IS_CRLF 'eol native is crlf' ' + + rm -rf native_eol && mkdir native_eol && + ( cd native_eol && + printf "*.txt text\n" > .gitattributes + printf "one\r\ntwo\r\nthree\r\n" > filedos.txt + printf "one\ntwo\nthree\n" > fileunix.txt + git init && + git config core.autocrlf false && + git config core.eol native && + git add filedos.txt fileunix.txt && + git commit -m "first" && + rm file*.txt && + git reset --hard HEAD && + has_cr filedos.txt && has_cr fileunix.txt + ) +' + test_done From 955e43dfa80c4d8289a6274065d456788cf0d2dc Mon Sep 17 00:00:00 2001 From: Brice Lambson Date: Thu, 15 Aug 2013 18:58:39 -0700 Subject: [PATCH 28/29] MinGW: Update tests to handle a native eol of crlf Some of the tests were written with the assumption that the native eol would always be lf. After defining NATIVE_CRLF on MinGW, these tests began failing. This change will update the tests to also handle a native eol of crlf. Signed-off-by: Brice Lambson --- t/t0026-eol-config.sh | 16 +---------- t/t6038-merge-text-auto.sh | 54 ++++++++++++++++++++++++-------------- t/test-lib.sh | 1 + 3 files changed, 36 insertions(+), 35 deletions(-) diff --git a/t/t0026-eol-config.sh b/t/t0026-eol-config.sh index a524f046b9..00ff53f768 100755 --- a/t/t0026-eol-config.sh +++ b/t/t0026-eol-config.sh @@ -8,20 +8,6 @@ has_cr() { tr '\015' Q <"$1" | grep Q >/dev/null } -# core.eol crlf and core.autocrlf input are not permitted. -# this lets us check for the core.eol native being crlf. -set_native_eol_prereq() { - rm -rf eol && mkdir eol && - ( cd eol && - git init --quiet && - git config core.autocrlf input && - git config core.eol native && - git var core.eol 2> /dev/null - ) || - test_set_prereq NATIVE_EOL_IS_CRLF -} -set_native_eol_prereq - test_expect_success setup ' git config core.autocrlf false && @@ -94,7 +80,7 @@ test_expect_success 'autocrlf=true overrides unset eol' ' test -z "$onediff" -a -z "$twodiff" ' -test_expect_success NATIVE_EOL_IS_CRLF 'eol native is crlf' ' +test_expect_success NATIVE_CRLF 'eol native is crlf' ' rm -rf native_eol && mkdir native_eol && ( cd native_eol && diff --git a/t/t6038-merge-text-auto.sh b/t/t6038-merge-text-auto.sh index d9c2d386dd..67c59b7e97 100755 --- a/t/t6038-merge-text-auto.sh +++ b/t/t6038-merge-text-auto.sh @@ -72,6 +72,10 @@ test_expect_success 'Merge after setting text=auto' ' same line EOF + if test_have_prereq NATIVE_CRLF; then + append_cr expected.temp && + mv expected.temp expected + fi && git config merge.renormalize true && git rm -fr . && rm -f .gitattributes && @@ -86,6 +90,10 @@ test_expect_success 'Merge addition of text=auto' ' same line EOF + if test_have_prereq NATIVE_CRLF; then + append_cr expected.temp && + mv expected.temp expected + fi && git config merge.renormalize true && git rm -fr . && rm -f .gitattributes && @@ -95,16 +103,19 @@ test_expect_success 'Merge addition of text=auto' ' ' test_expect_success 'Detect CRLF/LF conflict after setting text=auto' ' - q_to_cr <<-\EOF >expected && - <<<<<<< - first line - same line - ======= - first lineQ - same lineQ - >>>>>>> - EOF - + echo "<<<<<<<" >expected && + if test_have_prereq NATIVE_CRLF; then + echo first line | append_cr >>expected && + echo same line | append_cr >>expected && + echo ======= | append_cr >>expected + else + echo first line >>expected && + echo same line >>expected && + echo ======= >>expected + fi && + echo first line | append_cr >>expected && + echo same line | append_cr >>expected && + echo ">>>>>>>" >>expected && git config merge.renormalize false && rm -f .gitattributes && git reset --hard a && @@ -114,16 +125,19 @@ test_expect_success 'Detect CRLF/LF conflict after setting text=auto' ' ' test_expect_success 'Detect LF/CRLF conflict from addition of text=auto' ' - q_to_cr <<-\EOF >expected && - <<<<<<< - first lineQ - same lineQ - ======= - first line - same line - >>>>>>> - EOF - + echo "<<<<<<<" >expected && + echo first line | append_cr >>expected && + echo same line | append_cr >>expected && + if test_have_prereq NATIVE_CRLF; then + echo ======= | append_cr >>expected && + echo first line | append_cr >>expected && + echo same line | append_cr >>expected + else + echo ======= >>expected && + echo first line >>expected && + echo same line >>expected + fi && + echo ">>>>>>>" >>expected && git config merge.renormalize false && rm -f .gitattributes && git reset --hard b && diff --git a/t/test-lib.sh b/t/test-lib.sh index d5abf0f4fd..1ddee3345c 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -754,6 +754,7 @@ case $(uname -s) in # exec does not inherit the PID test_set_prereq MINGW test_set_prereq NOT_CYGWIN + test_set_prereq NATIVE_CRLF test_set_prereq SED_STRIPS_CR test_set_prereq GREP_STRIPS_CR GIT_TEST_CMP=mingw_test_cmp From da5160ac0b255fcc63c3c6b25b85273c438a3ff4 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 27 Dec 2013 17:19:44 -0600 Subject: [PATCH 29/29] Disable t0110's high-bit test on Windows The bash Git for Windows uses (i.e. the MSys bash) cannot pass command-line arguments with high bits set verbatim to non-MSys programs, but instead converts those characters with high bits set to their hex representation. For example, when running strings "$(echo -e '\x80')" (where strings.exe is a MinGW program, not an MSys one) it will complain about not finding the file called "80". Signed-off-by: Johannes Schindelin --- t/t0110-urlmatch-normalization.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t0110-urlmatch-normalization.sh b/t/t0110-urlmatch-normalization.sh index 8d6096d4d1..bcbb825034 100755 --- a/t/t0110-urlmatch-normalization.sh +++ b/t/t0110-urlmatch-normalization.sh @@ -117,7 +117,7 @@ test_expect_success 'url general escapes' ' test "$(test-urlmatch-normalization -p "X://W?'\!'")" = "x://w/?'\!'" ' -test_expect_success 'url high-bit escapes' ' +test_expect_success !MINGW 'url high-bit escapes' ' test "$(test-urlmatch-normalization -p "$(cat "$tu-1")")" = "x://q/%01%02%03%04%05%06%07%08%0E%0F%10%11%12" && test "$(test-urlmatch-normalization -p "$(cat "$tu-2")")" = "x://q/%13%14%15%16%17%18%19%1B%1C%1D%1E%1F%7F" && test "$(test-urlmatch-normalization -p "$(cat "$tu-3")")" = "x://q/%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F" &&