Git development
 help / color / mirror / Atom feed
* Re: [PATCH 08/14] help.c: Fix detection of custom merge strategy on cygwin
From: Erik Faye-Lund @ 2010-12-14 20:07 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Junio C Hamano, GIT Mailing-list, j6t, jrnieder, vmiklos
In-Reply-To: <4D07B786.2060602@ramsay1.demon.co.uk>

On Tue, Dec 14, 2010 at 7:29 PM, Ramsay Jones
<ramsay@ramsay1.demon.co.uk> wrote:
>
> Test t7606-merge-custom.sh fails on cygwin when git-merge fails
> with an "Could not find merge strategy 'theirs'" error, despite
> the test correctly preparing an (executable) git-merge-theirs
> script.
>
> The cause of the failure is the mis-detection of the executable
> status of the script, by the is_executable() function, while the
> load_command_list() function is searching the path for additional
> merge strategy programs.
>
> Note that the l/stat() "functions" on cygwin are somewhat
> schizophrenic (see commits adbc0b6, 7faee6b and 7974843), and
> their behaviour depends on the timing of various git setup and
> config function calls. In particular, until the "git_dir" has
> been set (have_git_dir() returns true), the real cygwin (POSIX
> emulating) l/stat() functions are called. Once "git_dir" has
> been set, the "native Win32 API" implementations of l/stat()
> may, or may not, be called depending on the setting of the
> core.filemode and core.ignorecygwinfstricks config variables.
>
> We also note that, since commit c869753, core.filemode is forced
> to false, even on NTFS, by git-init and git-clone. A user (or a
> test) can, of course, reset core.filemode to true explicitly if
> the filesystem supports it (and he doesn't use any problematic
> windows software). The test-suite currently runs all tests on
> cygwin with core.filemode set to false.
>
> Given the above, we see that the built-in merge strategies are
> correctly detected as executable, since they are checked for
> before "git_dir" is set, whereas all custom merge strategies are
> not, since they are checked for after "git_dir" is set.
>
> In order to fix the mis-detection problem, we change the code in
> is_executable() to re-use the conditional WIN32 code section,
> which actually looks at the content of the file to determine if
> the file is executable. On cygwin we also make the additional
> code conditional on the executable bit of the file mode returned
> by the initial stat() call. (only the real cygwin function would
> set the executable bit in the file mode.)
>
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> ---
>  help.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/help.c b/help.c
> index 7f4928e..eabadc9 100644
> --- a/help.c
> +++ b/help.c
> @@ -126,7 +126,10 @@ static int is_executable(const char *name)
>            !S_ISREG(st.st_mode))
>                return 0;
>
> -#ifdef WIN32
> +#if defined(WIN32) || defined(__CYGWIN__)
> +#if defined(__CYGWIN__)
> +if ((st.st_mode & S_IXUSR) == 0)
> +#endif

Perhaps the first check should simply be changed to check for _WIN32
instead of WIN32? IIRC _WIN32 is set on Cygwin, but I could be
mistaken...

^ permalink raw reply

* Re: [PATCH 12/14] t3032-*.sh: Do not strip CR from line-endings while grepping on MinGW
From: Junio C Hamano @ 2010-12-14 19:44 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: GIT Mailing-list, patthoyts
In-Reply-To: <4D07B904.8040206@ramsay1.demon.co.uk>

Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:

> By default grep reads in text mode and converts CRLF into LF line
> endings, which causes tests 4, 6 and 8 to fail. In a similar manner
> to commit a94114ad  (Do not strip CR when grepping HTTP headers,
> 2010-09-12), we set (and export) the GREP_OPTIONS variable to -U so
> that grep will use binary mode.
>
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>

Adding these GNU specific options leaves a bad aftertaste in my mouth, but
I'd pass them, as their use is limited to certain platforms with "prereq".

Thanks.

^ permalink raw reply

* Re: [PATCH 0/14] misc test-suite patches
From: Junio C Hamano @ 2010-12-14 19:44 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: GIT Mailing-list
In-Reply-To: <4D07B4C1.2050007@ramsay1.demon.co.uk>

Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:

> I've had many of these test-suite related patches lying around for
> a while, so I'm passing these along now in the hope I can remove
> some old branches...

Thanks.

> [PATCH 08/14] help.c: Fix detection of custom merge strategy on cygwin
> [PATCH 09/14] t1301-*.sh: Fix the 'forced modes' test on cygwin

I sense that there is something fundamentally wrong with the tricky l/stat
emulation set-up code there, but I lack an expertise to judge if these two
patches is going in the right direction.  Help from people savvier on
Windows issues than I is very much appreciated.

^ permalink raw reply

* Re: Revert-style merge/Working tree-only checkout?
From: Andreas Schwab @ 2010-12-14 19:37 UTC (permalink / raw)
  To: Konstantin Khomoutov; +Cc: Yuriy Romanenko, Git Mailing List
In-Reply-To: <20101214054604.GI3264@localhost.localdomain>

Konstantin Khomoutov <flatworm@users.sourceforge.net> writes:

> (2) $ git read-tree --reset master
> (3) $ git checkout-index --all --force

$ git rm -r .
$ git checkout master .

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply

* Re: [PATCH 14/14] t{3032,6038}-*.sh: Allow SED_BIN_OPT to override the -b sed option
From: Junio C Hamano @ 2010-12-14 19:31 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: GIT Mailing-list
In-Reply-To: <4D07BAE8.6070904@ramsay1.demon.co.uk>

Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:

> Some older versions of sed (eg. v3.02) do not understand the -b
> (--binary) option. However, these versions of sed may have an
> equivalent option we can use to request binary mode processing
> (eg. -c or --nocr).
>
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> ---
>
> I nearly didn't send this patch, since my MinGW sed is somewhat old, and
> most people would not have this problem. (Note I *think* I installed
> using msysGit-fullinstall-1.6.4-preview20090729.exe)
> So, feel free to drop this patch...
>
>  t/t3032-merge-recursive-options.sh |    2 +-
>  t/t6038-merge-text-auto.sh         |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/t/t3032-merge-recursive-options.sh b/t/t3032-merge-recursive-options.sh
> index 29e049a..22d9988 100755
> --- a/t/t3032-merge-recursive-options.sh
> +++ b/t/t3032-merge-recursive-options.sh
> @@ -13,7 +13,7 @@ test_description='merge-recursive options
>  
>  . ./test-lib.sh
>  
> -test_have_prereq SED_STRIPS_CR && SED_OPTIONS=-b
> +test_have_prereq SED_STRIPS_CR && SED_OPTIONS=${SED_BIN_OPT--b}

It is unclear who is supposed to feed you SED_BIN_OPT.

Perhaps a patch to add an insn like "If you have an ancient sed, export
SED_BIN_OPT=-c before running tests" to t/README is also necessary to go
together with this change.

^ permalink raw reply

* Re: [PATCH 11/14] t3032-*.sh: Pass the -b (--binary) option to sed on cygwin
From: Junio C Hamano @ 2010-12-14 19:24 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: GIT Mailing-list, sunshine
In-Reply-To: <4D07B8B5.2030409@ramsay1.demon.co.uk>

Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:

> The test using the conflict_hunks helper function (test 9) fails
> on cygwin, since sed (by default) throws away the CR from CRLF
> line endings. This behaviour is undesirable, since the validation
> code expects the CRLF line-ending to be present. In order to fix
> the problem we pass the -b (--binary) option to sed, using the
> SED_OPTIONS variable. We use the SED_STRIPS_CR prerequisite in the
> conditional initialisation of SED_OPTIONS.
>
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> ---
>
> Note that this test does not fail on MinGW, but I don't
> really know why, given commit ca02ad3... ahem ;-)

Ahem, indeed.  Why?

^ permalink raw reply

* Re: Corruption in the repository
From: Jonathan Nieder @ 2010-12-14 19:19 UTC (permalink / raw)
  To: Sylvestre Ledru
  Cc: git, Simon Gareste, Bruno JOFRET, Christian Couder,
	Shawn O. Pearce
In-Reply-To: <1292255990.25237.27642.camel@korcula.inria.fr>

Sylvestre Ledru wrote:

> error: refs/changes/98/398/1 does not point to a valid object!
> error: refs/changes/98/398/2 does not point to a valid object!
> fatal: object cff52c24fba28408e7d021a8f35a717bef31521d is corrupted
> fatal: The remote end hung up unexpectedly

Ah, should have thought of this sooner.  There doesn't seem to be
corruption involved after all.

> Does anyone know how to repair this error ?

Use git from the "master" branch to consolidate pack files:

	~/src/git/bin-wrappers/git repack -a -d

Details are in f2e872aa5 (Work around EMFILE when there are too many
pack files, 2010-11-01), which will likely be part of git 1.7.4.
Thanks for reporting and sorry for the trouble.

Jonathan

^ permalink raw reply

* Re: [PATCH 07/14] t7800-difftool.sh: Fix a test failure on Cygwin
From: Junio C Hamano @ 2010-12-14 19:15 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: GIT Mailing-list, davvid
In-Reply-To: <4D07B724.8000901@ramsay1.demon.co.uk>

This is not just "test failure" but can cause a failure in the real life
for people who want "the last flag wins" to work, no?

I'll retitle the patch and queue it separately from other test fixes.

Thanks.

^ permalink raw reply

* Re: [PATCH 04/14] lib-git-svn.sh: Add check for missing mod_dav_svn module
From: Junio C Hamano @ 2010-12-14 19:11 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: GIT Mailing-list, normalperson, avarab
In-Reply-To: <4D07B63A.2020501@ramsay1.demon.co.uk>

Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:

> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> ---
>  t/lib-git-svn.sh |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
> index 919d45a..154f3d3 100644
> --- a/t/lib-git-svn.sh
> +++ b/t/lib-git-svn.sh
> @@ -101,6 +101,11 @@ start_httpd () {
>  		echo >&2 'SVN_HTTPD_PORT is not defined!'
>  		return
>  	fi
> +	if test ! -e "$SVN_HTTPD_MODULE_PATH/mod_dav_svn.so"
> +	then
> +		echo >&2 'Apache module "mod_dav_svn.so" not found'
> +		return 1
> +	fi

Others seem to check with "test -f" for things like this.
Also why "return 1" only on this codepath?

>  	if test -z "$repo_base_path"
>  	then
>  		repo_base_path=svn
> @@ -128,6 +133,7 @@ EOF
>  
>  stop_httpd () {
>  	test -z "$SVN_HTTPD_PORT" && return
> +	test ! -e "$GIT_DIR/httpd.conf" && return
>  	"$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k stop
>  }
>  
> -- 
> 1.7.3

^ permalink raw reply

* Re: [PATCH 06/14] t9501-*.sh: Fix a test failure on Cygwin
From: Jakub Narebski @ 2010-12-14 19:04 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Junio C Hamano, GIT Mailing-list, marada
In-Reply-To: <4D07B6DE.8080400@ramsay1.demon.co.uk>

Ramsay Jones wrote:
> 
> The first (setup) test attempts to create a file, using the
> test_commit function, called 'i can has snapshot?'. On cygwin
> (and MinGW) this fails with a "No such file or directory" error.
> In order to fix the tests, we simply remove the '?' wildcard
> from the name, since the purpose of these tests is not about
> creating funny filenames.
> 
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>

All right.

Acked-by: Jakub Narebski <jnareb@gmail.com>

BTW. if the test was about handling funny filenames (containing
leading, embedded and trailing space, +&@=<>"' characters), what
should we do instead?

> ---
>  t/t9501-gitweb-standalone-http-status.sh |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/t/t9501-gitweb-standalone-http-status.sh b/t/t9501-gitweb-standalone-http-status.sh
> index 2487da1..18825af 100755
> --- a/t/t9501-gitweb-standalone-http-status.sh
> +++ b/t/t9501-gitweb-standalone-http-status.sh
> @@ -16,7 +16,7 @@ code and message.'
>  # snapshot settings
>  
>  test_expect_success 'setup' "
> -	test_commit 'SnapshotTests' 'i can has snapshot?'
> +	test_commit 'SnapshotTests' 'i can has snapshot'
>  "
>  
>  
> -- 
> 1.7.3
> 
> 
> 

-- 
Jakub Narebski
Poland

^ permalink raw reply

* [PATCH 14/14] t{3032,6038}-*.sh: Allow SED_BIN_OPT to override the -b sed option
From: Ramsay Jones @ 2010-12-14 18:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list


Some older versions of sed (eg. v3.02) do not understand the -b
(--binary) option. However, these versions of sed may have an
equivalent option we can use to request binary mode processing
(eg. -c or --nocr).

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---

I nearly didn't send this patch, since my MinGW sed is somewhat old, and
most people would not have this problem. (Note I *think* I installed
using msysGit-fullinstall-1.6.4-preview20090729.exe)
So, feel free to drop this patch...

 t/t3032-merge-recursive-options.sh |    2 +-
 t/t6038-merge-text-auto.sh         |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t3032-merge-recursive-options.sh b/t/t3032-merge-recursive-options.sh
index 29e049a..22d9988 100755
--- a/t/t3032-merge-recursive-options.sh
+++ b/t/t3032-merge-recursive-options.sh
@@ -13,7 +13,7 @@ test_description='merge-recursive options
 
 . ./test-lib.sh
 
-test_have_prereq SED_STRIPS_CR && SED_OPTIONS=-b
+test_have_prereq SED_STRIPS_CR && SED_OPTIONS=${SED_BIN_OPT--b}
 test_have_prereq MINGW && export GREP_OPTIONS=-U
 
 test_expect_success 'setup' '
diff --git a/t/t6038-merge-text-auto.sh b/t/t6038-merge-text-auto.sh
index d9c2d38..4245d6e 100755
--- a/t/t6038-merge-text-auto.sh
+++ b/t/t6038-merge-text-auto.sh
@@ -14,7 +14,7 @@ test_description='CRLF merge conflict across text=auto change
 
 . ./test-lib.sh
 
-test_have_prereq SED_STRIPS_CR && SED_OPTIONS=-b
+test_have_prereq SED_STRIPS_CR && SED_OPTIONS=${SED_BIN_OPT--b}
 
 test_expect_success setup '
 	git config core.autocrlf false &&
-- 
1.7.3

^ permalink raw reply related

* [PATCH 12/14] t3032-*.sh: Do not strip CR from line-endings while grepping on MinGW
From: Ramsay Jones @ 2010-12-14 18:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list, patthoyts


By default grep reads in text mode and converts CRLF into LF line
endings, which causes tests 4, 6 and 8 to fail. In a similar manner
to commit a94114ad  (Do not strip CR when grepping HTTP headers,
2010-09-12), we set (and export) the GREP_OPTIONS variable to -U so
that grep will use binary mode.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 t/t3032-merge-recursive-options.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/t/t3032-merge-recursive-options.sh b/t/t3032-merge-recursive-options.sh
index f70f6c4..29e049a 100755
--- a/t/t3032-merge-recursive-options.sh
+++ b/t/t3032-merge-recursive-options.sh
@@ -14,6 +14,7 @@ test_description='merge-recursive options
 . ./test-lib.sh
 
 test_have_prereq SED_STRIPS_CR && SED_OPTIONS=-b
+test_have_prereq MINGW && export GREP_OPTIONS=-U
 
 test_expect_success 'setup' '
 	conflict_hunks () {
-- 
1.7.3

^ permalink raw reply related

* [PATCH 13/14] t4135-*.sh: Skip the "backslash" tests on cygwin
From: Ramsay Jones @ 2010-12-14 18:37 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list, jrnieder, j6t


The BSLASHPSPEC tests (11-13) fail on cygwin, since you can't
create files containing an backslash character in the name.
In order to skip these tests, we simply stop (incorrectly)
asserting the BSLASHPSPEC prerequisite in test-lib.sh.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---

Note t3700-*.sh has a test protected by BSLASHSPEC which
previously passed on cygwin and will now be (unnecessarily)
skipped. This test needs to be skipped on MinGW, given how
it is written; if you remove the single quotes around the
filename, however, it will pass even on MinGW.

 t/test-lib.sh |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 9e74357..aee7d20 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1061,7 +1061,6 @@ case $(uname -s) in
 	;;
 *CYGWIN*)
 	test_set_prereq POSIXPERM
-	test_set_prereq BSLASHPSPEC
 	test_set_prereq EXECKEEPSPID
 	test_set_prereq NOT_MINGW
 	test_set_prereq SED_STRIPS_CR
-- 
1.7.3

^ permalink raw reply related

* [PATCH 11/14] t3032-*.sh: Pass the -b (--binary) option to sed on cygwin
From: Ramsay Jones @ 2010-12-14 18:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list, sunshine


The test using the conflict_hunks helper function (test 9) fails
on cygwin, since sed (by default) throws away the CR from CRLF
line endings. This behaviour is undesirable, since the validation
code expects the CRLF line-ending to be present. In order to fix
the problem we pass the -b (--binary) option to sed, using the
SED_OPTIONS variable. We use the SED_STRIPS_CR prerequisite in the
conditional initialisation of SED_OPTIONS.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---

Note that this test does not fail on MinGW, but I don't
really know why, given commit ca02ad3... ahem ;-)

 t/t3032-merge-recursive-options.sh |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/t/t3032-merge-recursive-options.sh b/t/t3032-merge-recursive-options.sh
index 2293797..f70f6c4 100755
--- a/t/t3032-merge-recursive-options.sh
+++ b/t/t3032-merge-recursive-options.sh
@@ -13,9 +13,11 @@ test_description='merge-recursive options
 
 . ./test-lib.sh
 
+test_have_prereq SED_STRIPS_CR && SED_OPTIONS=-b
+
 test_expect_success 'setup' '
 	conflict_hunks () {
-		sed -n -e "
+		sed $SED_OPTIONS -n -e "
 			/^<<<</ b inconflict
 			b
 			: inconflict
-- 
1.7.3

^ permalink raw reply related

* [PATCH 10/14] t6038-*.sh: Pass the -b (--binary) option to sed on cygwin
From: Ramsay Jones @ 2010-12-14 18:32 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list, sunshine


The tests using the fuzz_conflict helper function (tests 5-6)
fail on cygwin in the same way they used to on MinGW, prior
to commit ca02ad3. The solution is also the same; passing the
-b (--binary) option to sed, using the SED_OPTIONS variable.
We introduce a new prerequisite SED_STRIPS_CR to use in the
conditional initialisation of SED_OPTIONS, rather than MINGW.
The new prerequisite is set in test-lib.sh for both MinGW and
Cygwin.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 t/t6038-merge-text-auto.sh |    2 +-
 t/test-lib.sh              |    8 ++++++++
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/t/t6038-merge-text-auto.sh b/t/t6038-merge-text-auto.sh
index 460bf74..d9c2d38 100755
--- a/t/t6038-merge-text-auto.sh
+++ b/t/t6038-merge-text-auto.sh
@@ -14,7 +14,7 @@ test_description='CRLF merge conflict across text=auto change
 
 . ./test-lib.sh
 
-test_have_prereq MINGW && SED_OPTIONS=-b
+test_have_prereq SED_STRIPS_CR && SED_OPTIONS=-b
 
 test_expect_success setup '
 	git config core.autocrlf false &&
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 48fa516..9e74357 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1057,6 +1057,14 @@ case $(uname -s) in
 	# backslashes in pathspec are converted to '/'
 	# exec does not inherit the PID
 	test_set_prereq MINGW
+	test_set_prereq SED_STRIPS_CR
+	;;
+*CYGWIN*)
+	test_set_prereq POSIXPERM
+	test_set_prereq BSLASHPSPEC
+	test_set_prereq EXECKEEPSPID
+	test_set_prereq NOT_MINGW
+	test_set_prereq SED_STRIPS_CR
 	;;
 *)
 	test_set_prereq POSIXPERM
-- 
1.7.3

^ permalink raw reply related

* [PATCH 09/14] t1301-*.sh: Fix the 'forced modes' test on cygwin
From: Ramsay Jones @ 2010-12-14 18:30 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list, dpotapov, j6t


The 'forced modes' test fails on cygwin because the post-update
hook loses it's executable bit when copied from the templates
directory by git-init. The template loses it's executable bit
because the lstat() function resolves to the "native Win32 API"
implementation.

This call to lstat() happens after git-init has set the "git_dir"
(so has_git_dir() returns true), but before the configuration has
been fully initialised. At this point git_config() does not find
any config files to parse and returns 0. Unfortunately, the code
used to determine the cygwin l/stat() function bindings did not
check the return from git_config() and assumed that the config
was complete and accessible once "git_dir" was set.

In order to fix the test, we simply change the binding code to
test the return value from git_config(), to ensure that it actually
had config values to read, before determining the requested binding.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 compat/cygwin.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/compat/cygwin.c b/compat/cygwin.c
index b4a51b9..b38dbd7 100644
--- a/compat/cygwin.c
+++ b/compat/cygwin.c
@@ -114,8 +114,7 @@ static int git_cygwin_config(const char *var, const char *value, void *cb)
 
 static int init_stat(void)
 {
-	if (have_git_dir()) {
-		git_config(git_cygwin_config, NULL);
+	if (have_git_dir() && git_config(git_cygwin_config,NULL)) {
 		if (!core_filemode && native_stat) {
 			cygwin_stat_fn = cygwin_stat;
 			cygwin_lstat_fn = cygwin_lstat;
-- 
1.7.3

^ permalink raw reply related

* [PATCH 08/14] help.c: Fix detection of custom merge strategy on cygwin
From: Ramsay Jones @ 2010-12-14 18:29 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list, j6t, jrnieder, vmiklos


Test t7606-merge-custom.sh fails on cygwin when git-merge fails
with an "Could not find merge strategy 'theirs'" error, despite
the test correctly preparing an (executable) git-merge-theirs
script.

The cause of the failure is the mis-detection of the executable
status of the script, by the is_executable() function, while the
load_command_list() function is searching the path for additional
merge strategy programs.

Note that the l/stat() "functions" on cygwin are somewhat
schizophrenic (see commits adbc0b6, 7faee6b and 7974843), and
their behaviour depends on the timing of various git setup and
config function calls. In particular, until the "git_dir" has
been set (have_git_dir() returns true), the real cygwin (POSIX
emulating) l/stat() functions are called. Once "git_dir" has
been set, the "native Win32 API" implementations of l/stat()
may, or may not, be called depending on the setting of the
core.filemode and core.ignorecygwinfstricks config variables.

We also note that, since commit c869753, core.filemode is forced
to false, even on NTFS, by git-init and git-clone. A user (or a
test) can, of course, reset core.filemode to true explicitly if
the filesystem supports it (and he doesn't use any problematic
windows software). The test-suite currently runs all tests on
cygwin with core.filemode set to false.

Given the above, we see that the built-in merge strategies are
correctly detected as executable, since they are checked for
before "git_dir" is set, whereas all custom merge strategies are
not, since they are checked for after "git_dir" is set.

In order to fix the mis-detection problem, we change the code in
is_executable() to re-use the conditional WIN32 code section,
which actually looks at the content of the file to determine if
the file is executable. On cygwin we also make the additional
code conditional on the executable bit of the file mode returned
by the initial stat() call. (only the real cygwin function would
set the executable bit in the file mode.)

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 help.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/help.c b/help.c
index 7f4928e..eabadc9 100644
--- a/help.c
+++ b/help.c
@@ -126,7 +126,10 @@ static int is_executable(const char *name)
 	    !S_ISREG(st.st_mode))
 		return 0;
 
-#ifdef WIN32
+#if defined(WIN32) || defined(__CYGWIN__)
+#if defined(__CYGWIN__)
+if ((st.st_mode & S_IXUSR) == 0)
+#endif
 {	/* cannot trust the executable bit, peek into the file instead */
 	char buf[3] = { 0 };
 	int n;
-- 
1.7.3

^ permalink raw reply related

* [PATCH 06/14] t9501-*.sh: Fix a test failure on Cygwin
From: Ramsay Jones @ 2010-12-14 18:26 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list, marada, jnareb


The first (setup) test attempts to create a file, using the
test_commit function, called 'i can has snapshot?'. On cygwin
(and MinGW) this fails with a "No such file or directory" error.
In order to fix the tests, we simply remove the '?' wildcard
from the name, since the purpose of these tests is not about
creating funny filenames.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 t/t9501-gitweb-standalone-http-status.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t9501-gitweb-standalone-http-status.sh b/t/t9501-gitweb-standalone-http-status.sh
index 2487da1..18825af 100755
--- a/t/t9501-gitweb-standalone-http-status.sh
+++ b/t/t9501-gitweb-standalone-http-status.sh
@@ -16,7 +16,7 @@ code and message.'
 # snapshot settings
 
 test_expect_success 'setup' "
-	test_commit 'SnapshotTests' 'i can has snapshot?'
+	test_commit 'SnapshotTests' 'i can has snapshot'
 "
 
 
-- 
1.7.3

^ permalink raw reply related

* [PATCH 07/14] t7800-difftool.sh: Fix a test failure on Cygwin
From: Ramsay Jones @ 2010-12-14 18:27 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list, davvid


In particular, test 14 'difftool last flag wins' fails. This is
caused by git-difftool.perl passing both GIT_DIFFTOOL_NO_PROMPT
(='true') and GIT_DIFFTOOL_PROMPT (='true') to the difftool helper
script. Despite the appropriate key being deleted from the ENV
hash, it seems that once a key has been set in the hash, it gets
passed along to the system() call. (ie deleting the key does not
do the equivalent of unsetenv()).

In order to fix the problem, we keep track of the required prompt
state while processing the arguments, and then set the relevant
ENV hash key only once at the end.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 git-difftool.perl |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/git-difftool.perl b/git-difftool.perl
index e95e4ad..ced1615 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -52,6 +52,7 @@ sub generate_command
 	my @command = (exe('git'), 'diff');
 	my $skip_next = 0;
 	my $idx = -1;
+	my $prompt = '';
 	for my $arg (@ARGV) {
 		$idx++;
 		if ($skip_next) {
@@ -89,13 +90,11 @@ sub generate_command
 			next;
 		}
 		if ($arg eq '-y' || $arg eq '--no-prompt') {
-			$ENV{GIT_DIFFTOOL_NO_PROMPT} = 'true';
-			delete $ENV{GIT_DIFFTOOL_PROMPT};
+			$prompt = 'no';
 			next;
 		}
 		if ($arg eq '--prompt') {
-			$ENV{GIT_DIFFTOOL_PROMPT} = 'true';
-			delete $ENV{GIT_DIFFTOOL_NO_PROMPT};
+			$prompt = 'yes';
 			next;
 		}
 		if ($arg eq '-h' || $arg eq '--help') {
@@ -103,6 +102,11 @@ sub generate_command
 		}
 		push @command, $arg;
 	}
+	if ($prompt eq 'yes') {
+		$ENV{GIT_DIFFTOOL_PROMPT} = 'true';
+	} elsif ($prompt eq 'no') {
+		$ENV{GIT_DIFFTOOL_NO_PROMPT} = 'true';
+	}
 	return @command
 }
 
-- 
1.7.3

^ permalink raw reply related

* [PATCH 05/14] lib-git-svn.sh: Add check for mis-configured web server variables
From: Ramsay Jones @ 2010-12-14 18:25 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list, normalperson, avarab



Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 t/lib-git-svn.sh |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 154f3d3..5acc0ec 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -81,6 +81,11 @@ then
 			break
 		fi
 	done
+	if test -z "$SVN_HTTPD_PATH"
+	then
+		skip_all='skipping git svn tests, Apache not found'
+		test_done
+	fi
 	for d in \
 		"$SVN_HTTPD_MODULE_PATH" \
 		/usr/lib/apache2/modules \
@@ -92,6 +97,11 @@ then
 			break
 		fi
 	done
+	if test -z "$SVN_HTTPD_MODULE_PATH"
+	then
+		skip_all='skipping git svn tests, Apache module dir not found'
+		test_done
+	fi
 fi
 
 start_httpd () {
-- 
1.7.3

^ permalink raw reply related

* [PATCH 04/14] lib-git-svn.sh: Add check for missing mod_dav_svn module
From: Ramsay Jones @ 2010-12-14 18:23 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list, normalperson, avarab



Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 t/lib-git-svn.sh |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 919d45a..154f3d3 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -101,6 +101,11 @@ start_httpd () {
 		echo >&2 'SVN_HTTPD_PORT is not defined!'
 		return
 	fi
+	if test ! -e "$SVN_HTTPD_MODULE_PATH/mod_dav_svn.so"
+	then
+		echo >&2 'Apache module "mod_dav_svn.so" not found'
+		return 1
+	fi
 	if test -z "$repo_base_path"
 	then
 		repo_base_path=svn
@@ -128,6 +133,7 @@ EOF
 
 stop_httpd () {
 	test -z "$SVN_HTTPD_PORT" && return
+	test ! -e "$GIT_DIR/httpd.conf" && return
 	"$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k stop
 }
 
-- 
1.7.3

^ permalink raw reply related

* [PATCH 03/14] lib-git-svn.sh: Avoid setting web server variables unnecessarily
From: Ramsay Jones @ 2010-12-14 18:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list, normalperson, avarab


If the SVN_HTTPD_PORT variable is not set, then we will not even
attempt to start a web server in the start_httpd function (despite
it's name), so there is no need to determine values for the
SVN_HTTPD_PATH and SVN_HTTPD_MODULE_PATH variables.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 t/lib-git-svn.sh |   47 +++++++++++++++++++++++++----------------------
 1 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 92d6d31..919d45a 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -68,28 +68,31 @@ svn_cmd () {
 	svn "$orig_svncmd" --config-dir "$svnconf" "$@"
 }
 
-for d in \
-	"$SVN_HTTPD_PATH" \
-	/usr/sbin/apache2 \
-	/usr/sbin/httpd \
-; do
-	if test -f "$d"
-	then
-		SVN_HTTPD_PATH="$d"
-		break
-	fi
-done
-for d in \
-	"$SVN_HTTPD_MODULE_PATH" \
-	/usr/lib/apache2/modules \
-	/usr/libexec/apache2 \
-; do
-	if test -d "$d"
-	then
-		SVN_HTTPD_MODULE_PATH="$d"
-		break
-	fi
-done
+if test -n "$SVN_HTTPD_PORT"
+then
+	for d in \
+		"$SVN_HTTPD_PATH" \
+		/usr/sbin/apache2 \
+		/usr/sbin/httpd \
+	; do
+		if test -f "$d"
+		then
+			SVN_HTTPD_PATH="$d"
+			break
+		fi
+	done
+	for d in \
+		"$SVN_HTTPD_MODULE_PATH" \
+		/usr/lib/apache2/modules \
+		/usr/libexec/apache2 \
+	; do
+		if test -d "$d"
+		then
+			SVN_HTTPD_MODULE_PATH="$d"
+			break
+		fi
+	done
+fi
 
 start_httpd () {
 	repo_base_path="$1"
-- 
1.7.3

^ permalink raw reply related

* [PATCH 02/14] t9142: Move call to start_httpd into the setup test
From: Ramsay Jones @ 2010-12-14 18:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list, normalperson


In addition to being more consistent with the other calls to
start_httpd in tests t9115-*.sh, t9118-*.sh and t9120-*.sh, this
has the added benefit of making the test less noisy. (start_httpd
writes "SVN_HTTPD_PORT is not defined!" on stderr.)

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 t/t9142-git-svn-shallow-clone.sh |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/t/t9142-git-svn-shallow-clone.sh b/t/t9142-git-svn-shallow-clone.sh
index 1236acc..e21ee5f 100755
--- a/t/t9142-git-svn-shallow-clone.sh
+++ b/t/t9142-git-svn-shallow-clone.sh
@@ -17,11 +17,10 @@ test_expect_success 'setup test repository' '
 		> foo &&
 		svn_cmd add foo &&
 		svn_cmd commit -m "add foo"
-	)
+	) &&
+	start_httpd
 '
 
-start_httpd
-
 test_expect_success 'clone trunk with "-r HEAD"' '
 	git svn clone -r HEAD "$svnrepo/trunk" g &&
 	( cd g && git rev-parse --symbolic --verify HEAD )
-- 
1.7.3

^ permalink raw reply related

* [PATCH 01/14] t3600-rm.sh: Don't pass a non-existent prereq to test #15
From: Ramsay Jones @ 2010-12-14 18:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list, avarab


Commit c91cfd19 (tests: A SANITY test prereq for testing if we're
root, 2010-08-06) introduced a SANITY prerequisite which had very
similar semantics to RO_DIR. That commit removed the code to set
RO_DIR, but forgot to replace RO_DIR with SANITY in test #15.

In order not to skip test 15 unnecessarily, since RO_DIR will never
be set, we pass the SANITY prerequisite instead.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 t/t3600-rm.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index b26cabd..cd093bd 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -96,7 +96,7 @@ test_expect_success FUNNYNAMES \
     "git rm -f 'space embedded' 'tab	embedded' 'newline
 embedded'"
 
-test_expect_success RO_DIR 'Test that "git rm -f" fails if its rm fails' '
+test_expect_success SANITY 'Test that "git rm -f" fails if its rm fails' '
 	chmod a-w . &&
 	test_must_fail git rm -f baz &&
 	chmod 775 .
-- 
1.7.3

^ permalink raw reply related

* [PATCH 0/14] misc test-suite patches
From: Ramsay Jones @ 2010-12-14 18:17 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list

Hi Junio,

I've had many of these test-suite related patches lying around for
a while, so I'm passing these along now in the hope I can remove
some old branches...

[PATCH 01/14] t3600-rm.sh: Don't pass a non-existent prereq to test #15
[PATCH 02/14] t9142: Move call to start_httpd into the setup test
[PATCH 03/14] lib-git-svn.sh: Avoid setting web server variables unnecessarily
[PATCH 04/14] lib-git-svn.sh: Add check for missing mod_dav_svn module
[PATCH 05/14] lib-git-svn.sh: Add check for mis-configured web server variables
[PATCH 06/14] t9501-*.sh: Fix a test failure on Cygwin
[PATCH 07/14] t7800-difftool.sh: Fix a test failure on Cygwin
[PATCH 08/14] help.c: Fix detection of custom merge strategy on cygwin
[PATCH 09/14] t1301-*.sh: Fix the 'forced modes' test on cygwin
[PATCH 10/14] t6038-*.sh: Pass the -b (--binary) option to sed on cygwin
[PATCH 11/14] t3032-*.sh: Pass the -b (--binary) option to sed on cygwin
[PATCH 12/14] t3032-*.sh: Do not strip CR from line-endings while grepping on MinGW
[PATCH 13/14] t4135-*.sh: Skip the "backslash" tests on cygwin
[PATCH 14/14] t{3032,6038}-*.sh: Allow SED_BIN_OPT to override the -b sed option

These patches don't really have too much in common, well 2-5 and 10-12 are
somewhat related, other than fixing tests! (These were mostly done on Linux
and Cygwin but, since I also test on MinGW, one or two are just for MinGW)

ATB,
Ramsay Jones

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox