All of lore.kernel.org
 help / color / mirror / Atom feed
From: Karsten Blees <karsten.blees@gmail.com>
To: Duy Nguyen <pclouds@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	 Git Mailing List <git@vger.kernel.org>,
	msysGit <msysgit@googlegroups.com>
Subject: [RFC/PATCH] Windows tests: let $TRASH_DIRECTORY point to native Windows path
Date: Tue, 29 Jul 2014 21:43:55 +0200	[thread overview]
Message-ID: <53D7F97B.7060607@gmail.com> (raw)
In-Reply-To: <CACsJy8DqdTWqVimK0o4rcBXL==iZCsu1OgX2W9ZbgebcSDaKxg@mail.gmail.com>

MSYS programs typically understand native Windows paths (e.g C:/git), but
native Windows programs (including MinGW) don't understand MSYS paths (e.g.
/c/git).

On Windows, set TRASH_DIRECTORY to the absolute native path so that it can
be used more easily in tests.

MSYS 'tar -f' interprets everything before ':' as hostname, not as drive
letter. Change respective tests to use stdin / stdout instead of '-f'. Also
use $TAR from GIT-BUILD-OPTIONS rather than hardcoded tar.

Signed-off-by: Karsten Blees <blees@dcon.de>
---

Am 25.07.2014 14:30, schrieb Duy Nguyen:
> On Wed, Jul 23, 2014 at 9:17 PM, Karsten Blees <karsten.blees@gmail.com> wrote:
>> With the version in pu, three tests fail. t7001 is fixed with a newer 'cp'.
>> The other two are unrelated (introduced by nd/multiple-work-trees topic).
>>
>> * t1501-worktree: failed 1
>>   As of 5bbcb072 "setup.c: support multi-checkout repo setup"
>>   Using $TRASH_DIRECTORY doesn't work on Windows.
>>
>> * t2026-prune-linked-checkouts: failed 1
>>   As of 404a45f1 "prune: strategies for linked checkouts"
>>   Dito.
> 
> I need your help here. Would saving $(pwd) to a variable and using it
> instead of $TRASH_DIRECTORY work? Some tests "cd" around and $(pwd)
> may not be the same as $TRASH_DIRECTORY.
> 

Yes, that would work.

(Actually, you'd only need to change 'echo "$TRASH_DIR..."' in two places (both
before cd'ing away). The other instances are parameters to non-msys programs and
are thus automatically mangled by msys.dll.)

However, I wonder why we don't set up TRASH_DIRECTORY to the native Windows path.
I believe we'd get much fewer 'special' cases that way. Ideally, you shouldn't
have to worry about the intricacies of MSYS path mangling when writing tests...

[CCing msysgit for opinions]


 t/t3513-revert-submodule.sh | 4 ++--
 t/t6041-bisect-submodule.sh | 4 ++--
 t/test-lib.sh               | 1 +
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/t/t3513-revert-submodule.sh b/t/t3513-revert-submodule.sh
index a1c4e02..4a44dd6 100755
--- a/t/t3513-revert-submodule.sh
+++ b/t/t3513-revert-submodule.sh
@@ -14,11 +14,11 @@ test_description='revert can handle submodules'
 git_revert () {
 	git status -su >expect &&
 	ls -1pR * >>expect &&
-	tar czf "$TRASH_DIRECTORY/tmp.tgz" * &&
+	"$TAR" cz * >"$TRASH_DIRECTORY/tmp.tgz" &&
 	git checkout "$1" &&
 	git revert HEAD &&
 	rm -rf * &&
-	tar xzf "$TRASH_DIRECTORY/tmp.tgz" &&
+	"$TAR" xz <"$TRASH_DIRECTORY/tmp.tgz" &&
 	git status -su >actual &&
 	ls -1pR * >>actual &&
 	test_cmp expect actual &&
diff --git a/t/t6041-bisect-submodule.sh b/t/t6041-bisect-submodule.sh
index c6b7aa6..0de614f 100755
--- a/t/t6041-bisect-submodule.sh
+++ b/t/t6041-bisect-submodule.sh
@@ -8,7 +8,7 @@ test_description='bisect can handle submodules'
 git_bisect () {
 	git status -su >expect &&
 	ls -1pR * >>expect &&
-	tar czf "$TRASH_DIRECTORY/tmp.tgz" * &&
+	"$TAR" cz * > "$TRASH_DIRECTORY/tmp.tgz" &&
 	GOOD=$(git rev-parse --verify HEAD) &&
 	git checkout "$1" &&
 	echo "foo" >bar &&
@@ -20,7 +20,7 @@ git_bisect () {
 	git bisect start &&
 	git bisect good $GOOD &&
 	rm -rf * &&
-	tar xzf "$TRASH_DIRECTORY/tmp.tgz" &&
+	"$TAR" xz <"$TRASH_DIRECTORY/tmp.tgz" &&
 	git status -su >actual &&
 	ls -1pR * >>actual &&
 	test_cmp expect actual &&
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 5102340..5f6397b 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -868,6 +868,7 @@ case $(uname -s) in
 		md5sum "$@"
 	}
 	# git sees Windows-style pwd
+	TRASH_DIRECTORY=$(pwd -W)
 	pwd () {
 		builtin pwd -W
 	}
-- 
2.0.2.897.g7f80809.dirty

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

  reply	other threads:[~2014-07-29 19:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-22 21:44 What's cooking in git.git (Jul 2014, #04; Tue, 22) Junio C Hamano
2014-07-23  6:56 ` Philip Oakley
2014-07-23 18:10   ` Junio C Hamano
2014-07-24 22:37     ` Philip Oakley
2014-07-24 22:45       ` Junio C Hamano
2014-07-25 22:08         ` Junio C Hamano
2014-07-28 22:12           ` Philip Oakley
2014-07-30 17:13           ` Everyday contents (was Re: What's cooking in git.git (Jul 2014, #04; Tue, 22)) Junio C Hamano
2014-08-05 20:26             ` Junio C Hamano
2014-08-05 21:00               ` Philip Oakley
2014-08-02 17:28           ` Everday contents (was part of " Philip Oakley
2014-08-03 17:29             ` Everday contents Junio C Hamano
2014-08-03 18:41               ` Philip Oakley
2014-08-04 17:00                 ` Junio C Hamano
2014-07-23 14:17 ` What's cooking in git.git (Jul 2014, #04; Tue, 22) Karsten Blees
2014-07-23 18:24   ` Junio C Hamano
2014-07-25 12:30   ` Duy Nguyen
2014-07-29 19:43     ` Karsten Blees [this message]
2014-08-27 13:08       ` [RFC/PATCH] Windows tests: let $TRASH_DIRECTORY point to native Windows path Duy Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53D7F97B.7060607@gmail.com \
    --to=karsten.blees@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=msysgit@googlegroups.com \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.