Some patches from msysGit
cover Some patches from msysGit
This series collects some recent patches required for msysGit applied onto 'next' for upstream application.
Johannes Schindelin (4):
t1020: disable the pwd test on MinGW
t1402: Ignore a few cases that must fail due to DOS path expansion
t9001: do not fail only due to CR/LF issues
t9300: do not run --cat-blob-fd related tests on MinGW
Pat Thoyts (3):
t9901: fix line-ending dependency on windows
mergetools: use the correct tool for Beyond Compare 3 on Windows
mingw: ensure sockets are initialized before calling gethostname
Sebastian Schuberth (1):
git-svn: On MSYS, escape and quote SVN_SSH also if set by the user
compat/mingw.c | 7 +++++++ compat/mingw.h | 3 +++ git-svn.perl | 15 +++++++-------- mergetools/bc3 | 9 ++++++++- t/t1020-subdirectory.sh | 2 +- t/t1402-check-ref-format.sh | 15 +++++++++------ t/t9001-send-email.sh | 1 + t/t9300-fast-import.sh | 8 ++++---- t/t9901-git-web--browse.sh | 10 +++++----- 9 files changed, 45 insertions(+), 25 deletions(-)
Signature · 1 line
1.7.7.1.gbba15
PATCH 1/8 t1020: disable the pwd test on MinGW
From: Johannes Schindelin <[email protected]>
It fails both for line ending and for DOS path reasons.
--- t/t1020-subdirectory.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
t/t1020-subdirectory.sh +1 -1
@@ -118,7 +118,7 @@ test_expect_success 'alias expansion' ' ) ' -test_expect_success '!alias expansion' ' +test_expect_success NOT_MINGW '!alias expansion' ' pwd >expect && ( git config alias.test !pwd &&
Signature · 1 line
1.7.7.1.gbba15
PATCH 2/8 t1402: Ignore a few cases that must fail due to DOS path expansion
In reply to Pat ThoytsFrom: Johannes Schindelin <[email protected]>
--- t/t1402-check-ref-format.sh | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-)
t/t1402-check-ref-format.sh +9 -6
@@ -36,7 +36,7 @@ invalid_ref 'refs///heads/foo' valid_ref 'refs///heads/foo' --normalize invalid_ref 'heads/foo/' invalid_ref '/heads/foo' -valid_ref '/heads/foo' --normalize +test_have_prereq MINGW || valid_ref '/heads/foo' --normalize invalid_ref '///heads/foo' valid_ref '///heads/foo' --normalize invalid_ref './foo'
@@ -120,9 +120,12 @@ invalid_ref "$ref" --allow-onelevel invalid_ref "$ref" --refspec-pattern invalid_ref "$ref" '--refspec-pattern --allow-onelevel' invalid_ref "$ref" --normalize -valid_ref "$ref" '--allow-onelevel --normalize' -invalid_ref "$ref" '--refspec-pattern --normalize' -valid_ref "$ref" '--refspec-pattern --allow-onelevel --normalize' +if test_have_prereq NOT_MINGW +then + valid_ref "$ref" '--allow-onelevel --normalize' + invalid_ref "$ref" '--refspec-pattern --normalize' + valid_ref "$ref" '--refspec-pattern --allow-onelevel --normalize' +fi test_expect_success "check-ref-format --branch @{-1}" ' T=$(git write-tree) &&
@@ -166,10 +169,10 @@ invalid_ref_normalized() { valid_ref_normalized 'heads/foo' 'heads/foo' valid_ref_normalized 'refs///heads/foo' 'refs/heads/foo' -valid_ref_normalized '/heads/foo' 'heads/foo' +test_have_prereq MINGW || valid_ref_normalized '/heads/foo' 'heads/foo' valid_ref_normalized '///heads/foo' 'heads/foo' invalid_ref_normalized 'foo' -invalid_ref_normalized '/foo' +test_have_prereq MINGW || invalid_ref_normalized '/foo' invalid_ref_normalized 'heads/foo/../bar' invalid_ref_normalized 'heads/./foo' invalid_ref_normalized 'heads\foo'
Signature · 1 line
1.7.7.1.gbba15
Re: [PATCH 2/8] t1402: Ignore a few cases that must fail due to DOS path expansion
Quoted 1 line · Pat Thoyts
t/t1402-check-ref-format.sh | 15 +++++++++------
Didn't we see a different patch that attempts to address the same issue recently on the list from J6t, or is this a fix for a different problem?
Quoted 44 lines
1 files changed, 9 insertions(+), 6 deletions(-)t/t1402-check-ref-format.sh +9
-6@@ -36,7 +36,7 @@ invalid_ref 'refs///heads/foo' valid_ref 'refs///heads/foo' --normalize invalid_ref 'heads/foo/' invalid_ref '/heads/foo' -valid_ref '/heads/foo' --normalize +test_have_prereq MINGW || valid_ref '/heads/foo' --normalize invalid_ref '///heads/foo' valid_ref '///heads/foo' --normalize invalid_ref './foo'@@ -120,9 +120,12 @@ invalid_ref "$ref" --allow-onelevel invalid_ref "$ref" --refspec-pattern invalid_ref "$ref" '--refspec-pattern --allow-onelevel' invalid_ref "$ref" --normalize -valid_ref "$ref" '--allow-onelevel --normalize' -invalid_ref "$ref" '--refspec-pattern --normalize' -valid_ref "$ref" '--refspec-pattern --allow-onelevel --normalize' +if test_have_prereq NOT_MINGW +then + valid_ref "$ref" '--allow-onelevel --normalize' + invalid_ref "$ref" '--refspec-pattern --normalize' + valid_ref "$ref" '--refspec-pattern --allow-onelevel --normalize' +fi test_expect_success "check-ref-format --branch @{-1}" ' T=$(git write-tree) &&@@ -166,10 +169,10 @@ invalid_ref_normalized() { valid_ref_normalized 'heads/foo' 'heads/foo' valid_ref_normalized 'refs///heads/foo' 'refs/heads/foo' -valid_ref_normalized '/heads/foo' 'heads/foo' +test_have_prereq MINGW || valid_ref_normalized '/heads/foo' 'heads/foo' valid_ref_normalized '///heads/foo' 'heads/foo' invalid_ref_normalized 'foo' -invalid_ref_normalized '/foo' +test_have_prereq MINGW || invalid_ref_normalized '/foo' invalid_ref_normalized 'heads/foo/../bar' invalid_ref_normalized 'heads/./foo' invalid_ref_normalized 'heads\foo'
Re: [PATCH 2/8] t1402: Ignore a few cases that must fail due to DOS path expansion
Quoted 7 lines · Junio C Hamano
Quoted 1 line · Pat Thoyts
t/t1402-check-ref-format.sh | 15 +++++++++------Didn't we see a different patch that attempts to address the same issue recently on the list from J6t, or is this a fix for a different problem?
You are correct - I'll leave this out of this series then. j6t's patch is an alternative fix for the same problem.
Signature · 2 lines
Pat Thoyts http://www.patthoyts.tk/ PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD
Re: [PATCH 2/8] t1402: Ignore a few cases that must fail due to DOS path expansion
Quoted 4 lines · Pat Thoyts
Quoted 2 lines · Junio C Hamano
Pat Thoyts <[email protected]> writes:
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
t/t1402-check-ref-format.sh | 15 +++++++++------Didn't we see a different patch that attempts to address the same issue recently on the list from J6t, or is this a fix for a different problem?
You are correct - I'll leave this out of this series then. j6t's patch is an alternative fix for the same problem.
Thanks for checking.
PATCH 3/8 t9001: do not fail only due to CR/LF issues
In reply to Pat ThoytsFrom: Johannes Schindelin <[email protected]>
--- t/t9001-send-email.sh | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
t/t9001-send-email.sh +1 -0
@@ -23,6 +23,7 @@ test_expect_success $PREREQ \ echo do echo " echo \"!\$a!\"" echo "done >commandline\$output" + test_have_prereq MINGW && echo "dos2unix commandline\$output" echo "cat > msgtxt\$output" ) >fake.sendmail && chmod +x ./fake.sendmail &&
Signature · 1 line
1.7.7.1.gbba15
PATCH 4/8 git-svn: On MSYS, escape and quote SVN_SSH also if set by the user
In reply to Pat ThoytsFrom: Sebastian Schuberth <[email protected]>
While GIT_SSH does not require any escaping / quoting (e.g. for paths containing spaces), SVN_SSH requires it due to its use in a Perl script.
Previously, SVN_SSH has only been escaped and quoted automatically if it was unset and thus derived from GIT_SSH. For user convenience, do the escaping and quoting also for a SVN_SSH set by the user. This way, the user is able to use the same unescaped and unquoted syntax for GIT_SSH and SVN_SSH.
--- git-svn.perl | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-)
git-svn.perl +7 -8
@@ -22,14 +22,13 @@ $Git::SVN::default_ref_id = $ENV{GIT_SVN_ID} || 'git-svn'; $Git::SVN::Ra::_log_window_size = 100; $Git::SVN::_minimize_url = 'unset'; -if (! exists $ENV{SVN_SSH}) { - if (exists $ENV{GIT_SSH}) { - $ENV{SVN_SSH} = $ENV{GIT_SSH}; - if ($^O eq 'msys') { - $ENV{SVN_SSH} =~ s/\\/\\\\/g; - $ENV{SVN_SSH} =~ s/(.*)/"$1"/; - } - } +if (! exists $ENV{SVN_SSH} && exists $ENV{GIT_SSH}) { + $ENV{SVN_SSH} = $ENV{GIT_SSH}; +} + +if (exists $ENV{SVN_SSH} && $^O eq 'msys') { + $ENV{SVN_SSH} =~ s/\\/\\\\/g; + $ENV{SVN_SSH} =~ s/(.*)/"$1"/; } $Git::SVN::Log::TZ = $ENV{TZ};
Signature · 1 line
1.7.7.1.gbba15
PATCH 5/8 t9901: fix line-ending dependency on windows
In reply to Pat Thoyts--- t/t9901-git-web--browse.sh | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
t/t9901-git-web--browse.sh +5 -5
@@ -12,7 +12,7 @@ test_expect_success \ echo http://example.com/foo\&bar >expect && git config browser.custom.cmd echo && git web--browse --browser=custom \ - http://example.com/foo\&bar >actual && + http://example.com/foo\&bar | tr -d "\r" >actual && test_cmp expect actual '
@@ -21,7 +21,7 @@ test_expect_success \ echo http://example.com/foo\;bar >expect && git config browser.custom.cmd echo && git web--browse --browser=custom \ - http://example.com/foo\;bar >actual && + http://example.com/foo\;bar | tr -d "\r" >actual && test_cmp expect actual '
@@ -30,7 +30,7 @@ test_expect_success \ echo http://example.com/foo#bar >expect && git config browser.custom.cmd echo && git web--browse --browser=custom \ - http://example.com/foo#bar >actual && + http://example.com/foo#bar | tr -d "\r" >actual && test_cmp expect actual '
@@ -44,7 +44,7 @@ test_expect_success \ chmod +x "fake browser" && git config browser.w3m.path "`pwd`/fake browser" && git web--browse --browser=w3m \ - http://example.com/foo >actual && + http://example.com/foo | tr -d "\r" >actual && test_cmp expect actual '
@@ -59,7 +59,7 @@ test_expect_success \ } f" && git web--browse --browser=custom \ - http://example.com/foo >actual && + http://example.com/foo | tr -d "\r" >actual && test_cmp expect actual '
Signature · 1 line
1.7.7.1.gbba15
Re: [PATCH 5/8] t9901: fix line-ending dependency on windows
Quoted 10 lines · Pat Thoyts
Signed-off-by Pat Thoyts <[email protected]>--- t/t9901-git-web--browse.sh | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)t/t9901-git-web--browse.sh +0
-0
t/t9901-git-web--browse.sh test_expect_success \ · line 17
Quoted 7 lines
t/t9901-git-web--browse.sh +1
-1@@ -12,7 +12,7 @@ test_expect_success \ echo http://example.com/foo\&bar >expect && git config browser.custom.cmd echo && git web--browse --browser=custom \ - http://example.com/foo\&bar >actual && + http://example.com/foo\&bar | tr -d "\r" >actual && test_cmp expect actual '
This is unnice for two reasons. We have web--browse five times in this test script, and you add tr exactly the same way to each and every one of them. And you are losing the error condition from each and every one of these web--browse invocations.
Having to do the same change to all invocations of the same command suggests that perhaps you can and should wrap that pattern into a single helper, perhaps like:
test_web_browse () {
# browser=$1 url=$2
git web--browse --browser="$1" "$2" >actual &&
tr -d '\015' <actual >text &&
test_cmp expect text
}or something?
Re: [PATCH 5/8] t9901: fix line-ending dependency on windows
Quoted 29 lines · Junio C Hamano
Quoted 10 lines · Pat Thoyts
Signed-off-by Pat Thoyts <[email protected]>--- t/t9901-git-web--browse.sh | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)t/t9901-git-web--browse.sh +0
-0t/t9901-git-web--browse.sh test_expect_success \ · line 17
Quoted 7 lines
t/t9901-git-web--browse.sh +1
-1@@ -12,7 +12,7 @@ test_expect_success \ echo http://example.com/foo\&bar >expect && git config browser.custom.cmd echo && git web--browse --browser=custom \ - http://example.com/foo\&bar >actual && + http://example.com/foo\&bar | tr -d "\r" >actual && test_cmp expect actual 'This is unnice for two reasons. We have web--browse five times in this test script, and you add tr exactly the same way to each and every one of them. And you are losing the error condition from each and every one of these web--browse invocations.
Having to do the same change to all invocations of the same command suggests that perhaps you can and should wrap that pattern into a single helper, perhaps like:
Quoted 8 lines
test_web_browse () { # browser=$1 url=$2 git web--browse --browser="$1" "$2" >actual && tr -d '\015' <actual >text && test_cmp expect text }or something?
OK - The suggested code works fine so I shall re-roll this one shortly.
Signature · 2 lines
Pat Thoyts http://www.patthoyts.tk/ PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD
PATCH 6/8 t9300: do not run --cat-blob-fd related tests on MinGW
In reply to Pat ThoytsFrom: Johannes Schindelin <[email protected]>
As diagnosed by Johannes Sixt, msys.dll does not hand through file descriptors > 2 to child processes, so these test cases cannot passes when run through an MSys bash.
--- t/t9300-fast-import.sh | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
t/t9300-fast-import.sh +4 -4
@@ -2237,7 +2237,7 @@ test_expect_success 'R: cat-blob-fd must be a nonnegative integer' ' test_must_fail git fast-import --cat-blob-fd=-1 </dev/null ' -test_expect_success 'R: print old blob' ' +test_expect_success NOT_MINGW 'R: print old blob' ' blob=$(echo "yes it can" | git hash-object -w --stdin) && cat >expect <<-EOF && ${blob} blob 11
@@ -2249,7 +2249,7 @@ test_expect_success 'R: print old blob' ' test_cmp expect actual ' -test_expect_success 'R: in-stream cat-blob-fd not respected' ' +test_expect_success NOT_MINGW 'R: in-stream cat-blob-fd not respected' ' echo hello >greeting && blob=$(git hash-object -w greeting) && cat >expect <<-EOF &&
@@ -2270,7 +2270,7 @@ test_expect_success 'R: in-stream cat-blob-fd not respected' ' test_cmp expect actual.1 ' -test_expect_success 'R: print new blob' ' +test_expect_success NOT_MINGW 'R: print new blob' ' blob=$(echo "yep yep yep" | git hash-object --stdin) && cat >expect <<-EOF && ${blob} blob 12
@@ -2288,7 +2288,7 @@ test_expect_success 'R: print new blob' ' test_cmp expect actual ' -test_expect_success 'R: print new blob by sha1' ' +test_expect_success NOT_MINGW 'R: print new blob by sha1' ' blob=$(echo "a new blob named by sha1" | git hash-object --stdin) && cat >expect <<-EOF && ${blob} blob 25
Signature · 1 line
1.7.7.1.gbba15
PATCH 7/8 mergetools: use the correct tool for Beyond Compare 3 on Windows
In reply to Pat ThoytsOn Windows the bcompare tool launches a graphical program and does not wait for it to terminate. A separate 'bcomp' tool is provided which will wait for the view to exit so we use this instead.
--- mergetools/bc3 | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
mergetools/bc3 +8 -1
@@ -16,5 +16,12 @@ merge_cmd () { } translate_merge_tool_path() { - echo bcompare + case $(uname -s) in + *MINGW*) + echo bcomp + ;; + *) + echo bcompare + ;; + esac }
Signature · 1 line
1.7.7.1.gbba15
Re: [PATCH 7/8] mergetools: use the correct tool for Beyond Compare 3 on Windows
Quoted 3 lines · Pat Thoyts
On Windows the bcompare tool launches a graphical program and does not wait for it to terminate. A separate 'bcomp' tool is provided which will wait for the view to exit so we use this instead.
Hmm, does this only apply to Windows, or are there other platforms on which BC3 supplies bcomp for the exact same reason? What I am trying to get at is that it might be nicer if we do not have to check uname, e.g.
if type bcomp >/dev/null 2>/dev/null
then
echo bcomp
else
echo bcompare
fi
Quoted 24 lines
Reported-by Werner BEROUX <[email protected]>Signed-off-by Pat Thoyts <[email protected]>--- mergetools/bc3 | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)mergetools/bc3 +8
-1@@ -16,5 +16,12 @@ merge_cmd () { } translate_merge_tool_path() { - echo bcompare + case $(uname -s) in + *MINGW*) + echo bcomp + ;; + *) + echo bcompare + ;; + esac }
Re: [PATCH 7/8] mergetools: use the correct tool for Beyond Compare 3 on Windows
Quoted 2 lines · Junio C Hamano
Hmm, does this only apply to Windows, or are there other platforms on which BC3 supplies bcomp for the exact same reason? What I am trying to
BC3 is only available for Linux and Windows, so it only applies to Windows currently.
Signature · 1 line
Sebastian Schuberth
Re: [PATCH 7/8] mergetools: use the correct tool for Beyond Compare 3 on Windows
Quoted 7 lines · Sebastian Schuberth
Quoted 2 lines · Junio C Hamano
Hmm, does this only apply to Windows, or are there other platforms on which BC3 supplies bcomp for the exact same reason? What I am trying to
BC3 is only available for Linux and Windows, so it only applies to Windows currently.
Who asked anything about "currently"?
Re: [PATCH 7/8] mergetools: use the correct tool for Beyond Compare 3 on Windows
Quoted 7 lines · Junio C Hamano
Quoted 5 lines
Quoted 2 lines
Hmm, does this only apply to Windows, or are there other platforms on which BC3 supplies bcomp for the exact same reason? What I am trying to
BC3 is only available for Linux and Windows, so it only applies to Windows currently.
Who asked anything about "currently"?
Heh, no one. But obviously I cannot predict the future, that's why I explicitly said "currently".
Here's what I was meaning to say in more long-winded words: Although BC3 only supports Linux and Windows currently, IMHO it is unlikely that future support for other platforms will suffer from the same issue as Windows and will require a different executable than "bcompare". And even if it was the case, that could be fixed then. For now the proposed patch covers all cases and works well, and although your suggestion would be more generic, it's not necessary, and the discussion about whether or not to use your more generic approach is starting to outweigh the time that was required to write this patch as well as the time that would be required for a future patch.
Signature · 1 line
Sebastian Schuberth
Re: [PATCH 7/8] mergetools: use the correct tool for Beyond Compare 3 on Windows
In reply to Sebastian SchuberthQuoted 7 lines · Sebastian Schuberth
Quoted 2 lines · Junio C Hamano
Hmm, does this only apply to Windows, or are there other platforms on which BC3 supplies bcomp for the exact same reason? What I am trying to
BC3 is only available for Linux and Windows, so it only applies to Windows currently.
And checking the linux distribution shows only a bcompare executable so testing for the presence of 'bcomp' will be fine.
Signature · 2 lines
Pat Thoyts http://www.patthoyts.tk/ PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD
Re: [PATCH 7/8] mergetools: use the correct tool for Beyond Compare 3 on Windows
Quoted 2 lines · Pat Thoyts
And checking the linux distribution shows only a bcompare executable so testing for the presence of 'bcomp' will be fine.
That's what I was implying, sorry for not being more clear. I also checked the Linux version of BC3 to verify that it only contains a "bcompare" executable.
Signature · 1 line
Sebastian Schuberth
Re: [PATCH 7/8] mergetools: use the correct tool for Beyond Compare 3 on Windows
In reply to Pat ThoytsQuoted 2 lines · Pat Thoyts
And checking the linux distribution shows only a bcompare executable so testing for the presence of 'bcomp' will be fine.
I was meaning to say the same thing, sorry for not being more clear. I also checked the Linux version of BC3 and verified that there's only a "bcompare" executable.
Signature · 1 line
Sebastian Schuberth
PATCH 8/8 mingw: ensure sockets are initialized before calling gethostname
In reply to Pat ThoytsIf the Windows sockets subsystem has not been initialized yet then an attempt to get the hostname returns an error and prints a warning to the console. This solves this issue for msysGit as seen with 'git fetch'.
--- compat/mingw.c | 7 +++++++ compat/mingw.h | 3 +++ 2 files changed, 10 insertions(+), 0 deletions(-)
compat/mingw.c +7 -0
@@ -1321,6 +1321,13 @@ static void ensure_socket_initialization(void) initialized =1 ; } +#undef gethostname +int mingw_gethostname (char *name,int namelen) +{ +ensure_socket_initialization (); +return gethostname (name, namelen); +} +#undef gethostbynamestruct hostent *mingw_gethostbyname (const char *host) {
compat/mingw.h +3 -0
@@ -190,6 +190,9 @@ char *mingw_getcwd(char *pointer, int len);char *mingw_getenv (const char *name);#define getenv mingw_getenv +int mingw_gethostname (char *host,int namelen); +#define gethostname mingw_gethostname +struct hostent *mingw_gethostbyname (const char *host);#define gethostbyname mingw_gethostbyname
Signature · 1 line
1.7.7.1.gbba15