Skip to content

Commit 578183b

Browse files
committed
Merge branch 'pt/mingw-misc-fixes'
* pt/mingw-misc-fixes: t9901: fix line-ending dependency on windows mingw: ensure sockets are initialized before calling gethostname mergetools: use the correct tool for Beyond Compare 3 on Windows t9300: do not run --cat-blob-fd related tests on MinGW git-svn: On MSYS, escape and quote SVN_SSH also if set by the user t9001: do not fail only due to CR/LF issues t1020: disable the pwd test on MinGW
2 parents 54633cd + f64943d commit 578183b

File tree

8 files changed

+41
-29
lines changed

8 files changed

+41
-29
lines changed

compat/mingw.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,13 @@ static void ensure_socket_initialization(void)
13211321
initialized = 1;
13221322
}
13231323

1324+
#undef gethostname
1325+
int mingw_gethostname(char *name, int namelen)
1326+
{
1327+
ensure_socket_initialization();
1328+
return gethostname(name, namelen);
1329+
}
1330+
13241331
#undef gethostbyname
13251332
struct hostent *mingw_gethostbyname(const char *host)
13261333
{

compat/mingw.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ char *mingw_getcwd(char *pointer, int len);
190190
char *mingw_getenv(const char *name);
191191
#define getenv mingw_getenv
192192

193+
int mingw_gethostname(char *host, int namelen);
194+
#define gethostname mingw_gethostname
195+
193196
struct hostent *mingw_gethostbyname(const char *host);
194197
#define gethostbyname mingw_gethostbyname
195198

git-svn.perl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@
2222
$Git::SVN::Ra::_log_window_size = 100;
2323
$Git::SVN::_minimize_url = 'unset';
2424

25-
if (! exists $ENV{SVN_SSH}) {
26-
if (exists $ENV{GIT_SSH}) {
27-
$ENV{SVN_SSH} = $ENV{GIT_SSH};
28-
if ($^O eq 'msys') {
29-
$ENV{SVN_SSH} =~ s/\\/\\\\/g;
30-
$ENV{SVN_SSH} =~ s/(.*)/"$1"/;
31-
}
32-
}
25+
if (! exists $ENV{SVN_SSH} && exists $ENV{GIT_SSH}) {
26+
$ENV{SVN_SSH} = $ENV{GIT_SSH};
27+
}
28+
29+
if (exists $ENV{SVN_SSH} && $^O eq 'msys') {
30+
$ENV{SVN_SSH} =~ s/\\/\\\\/g;
31+
$ENV{SVN_SSH} =~ s/(.*)/"$1"/;
3332
}
3433

3534
$Git::SVN::Log::TZ = $ENV{TZ};

mergetools/bc3

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,10 @@ merge_cmd () {
1616
}
1717

1818
translate_merge_tool_path() {
19-
echo bcompare
19+
if type bcomp >/dev/null 2>/dev/null
20+
then
21+
echo bcomp
22+
else
23+
echo bcompare
24+
fi
2025
}

t/t1020-subdirectory.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ test_expect_success 'alias expansion' '
118118
)
119119
'
120120

121-
test_expect_success '!alias expansion' '
121+
test_expect_success NOT_MINGW '!alias expansion' '
122122
pwd >expect &&
123123
(
124124
git config alias.test !pwd &&

t/t9001-send-email.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ test_expect_success $PREREQ \
2323
echo do
2424
echo " echo \"!\$a!\""
2525
echo "done >commandline\$output"
26+
test_have_prereq MINGW && echo "dos2unix commandline\$output"
2627
echo "cat > msgtxt\$output"
2728
) >fake.sendmail &&
2829
chmod +x ./fake.sendmail &&

t/t9300-fast-import.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2237,7 +2237,7 @@ test_expect_success 'R: cat-blob-fd must be a nonnegative integer' '
22372237
test_must_fail git fast-import --cat-blob-fd=-1 </dev/null
22382238
'
22392239

2240-
test_expect_success 'R: print old blob' '
2240+
test_expect_success NOT_MINGW 'R: print old blob' '
22412241
blob=$(echo "yes it can" | git hash-object -w --stdin) &&
22422242
cat >expect <<-EOF &&
22432243
${blob} blob 11
@@ -2249,7 +2249,7 @@ test_expect_success 'R: print old blob' '
22492249
test_cmp expect actual
22502250
'
22512251

2252-
test_expect_success 'R: in-stream cat-blob-fd not respected' '
2252+
test_expect_success NOT_MINGW 'R: in-stream cat-blob-fd not respected' '
22532253
echo hello >greeting &&
22542254
blob=$(git hash-object -w greeting) &&
22552255
cat >expect <<-EOF &&
@@ -2270,7 +2270,7 @@ test_expect_success 'R: in-stream cat-blob-fd not respected' '
22702270
test_cmp expect actual.1
22712271
'
22722272

2273-
test_expect_success 'R: print new blob' '
2273+
test_expect_success NOT_MINGW 'R: print new blob' '
22742274
blob=$(echo "yep yep yep" | git hash-object --stdin) &&
22752275
cat >expect <<-EOF &&
22762276
${blob} blob 12
@@ -2288,7 +2288,7 @@ test_expect_success 'R: print new blob' '
22882288
test_cmp expect actual
22892289
'
22902290

2291-
test_expect_success 'R: print new blob by sha1' '
2291+
test_expect_success NOT_MINGW 'R: print new blob by sha1' '
22922292
blob=$(echo "a new blob named by sha1" | git hash-object --stdin) &&
22932293
cat >expect <<-EOF &&
22942294
${blob} blob 25

t/t9901-git-web--browse.sh

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,32 @@ This test checks that git web--browse can handle various valid URLs.'
77

88
. ./test-lib.sh
99

10+
test_web_browse () {
11+
# browser=$1 url=$2
12+
git web--browse --browser="$1" "$2" >actual &&
13+
tr -d '\015' <actual >text &&
14+
test_cmp expect text
15+
}
16+
1017
test_expect_success \
1118
'URL with an ampersand in it' '
1219
echo http://example.com/foo\&bar >expect &&
1320
git config browser.custom.cmd echo &&
14-
git web--browse --browser=custom \
15-
http://example.com/foo\&bar >actual &&
16-
test_cmp expect actual
21+
test_web_browse custom http://example.com/foo\&bar
1722
'
1823

1924
test_expect_success \
2025
'URL with a semi-colon in it' '
2126
echo http://example.com/foo\;bar >expect &&
2227
git config browser.custom.cmd echo &&
23-
git web--browse --browser=custom \
24-
http://example.com/foo\;bar >actual &&
25-
test_cmp expect actual
28+
test_web_browse custom http://example.com/foo\;bar
2629
'
2730

2831
test_expect_success \
2932
'URL with a hash in it' '
3033
echo http://example.com/foo#bar >expect &&
3134
git config browser.custom.cmd echo &&
32-
git web--browse --browser=custom \
33-
http://example.com/foo#bar >actual &&
34-
test_cmp expect actual
35+
test_web_browse custom http://example.com/foo#bar
3536
'
3637

3738
test_expect_success \
@@ -43,9 +44,7 @@ test_expect_success \
4344
EOF
4445
chmod +x "fake browser" &&
4546
git config browser.w3m.path "`pwd`/fake browser" &&
46-
git web--browse --browser=w3m \
47-
http://example.com/foo >actual &&
48-
test_cmp expect actual
47+
test_web_browse w3m http://example.com/foo
4948
'
5049

5150
test_expect_success \
@@ -58,9 +57,7 @@ test_expect_success \
5857
done
5958
}
6059
f" &&
61-
git web--browse --browser=custom \
62-
http://example.com/foo >actual &&
63-
test_cmp expect actual
60+
test_web_browse custom http://example.com/foo
6461
'
6562

6663
test_done

0 commit comments

Comments
 (0)