Skip to content

Commit 269fe3a

Browse files
committed
Merge branch 'js/mingw-tests-2.8'
* js/mingw-tests-2.8: mingw: skip some tests in t9115 due to file name issues t1300: fix the new --show-origin tests on Windows t1300-repo-config: make it resilient to being run via 'sh -x' config --show-origin: report paths with forward slashes
2 parents 2a4c8c3 + 8257d3b commit 269fe3a

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

compat/mingw.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,12 @@ static inline char *mingw_find_last_dir_sep(const char *path)
396396
ret = (char *)path;
397397
return ret;
398398
}
399+
static inline void convert_slashes(char *path)
400+
{
401+
for (; *path; path++)
402+
if (*path == '\\')
403+
*path = '/';
404+
}
399405
#define find_last_dir_sep mingw_find_last_dir_sep
400406
int mingw_offset_1st_component(const char *path);
401407
#define offset_1st_component mingw_offset_1st_component

path.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,9 @@ char *expand_user_path(const char *path)
584584
if (!home)
585585
goto return_null;
586586
strbuf_addstr(&user_path, home);
587+
#ifdef GIT_WINDOWS_NATIVE
588+
convert_slashes(user_path.buf);
589+
#endif
587590
} else {
588591
struct passwd *pw = getpw_str(username, username_len);
589592
if (!pw)

t/t1300-repo-config.sh

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -699,17 +699,13 @@ test_expect_success 'invalid unit' '
699699
echo 1auto >expect &&
700700
git config aninvalid.unit >actual &&
701701
test_cmp expect actual &&
702-
cat >expect <<-\EOF &&
703-
fatal: bad numeric config value '\''1auto'\'' for '\''aninvalid.unit'\'' in file .git/config: invalid unit
704-
EOF
705702
test_must_fail git config --int --get aninvalid.unit 2>actual &&
706-
test_i18ncmp expect actual
703+
test_i18ngrep "bad numeric config value .1auto. for .aninvalid.unit. in file .git/config: invalid unit" actual
707704
'
708705

709706
test_expect_success 'invalid stdin config' '
710-
echo "fatal: bad config line 1 in standard input " >expect &&
711707
echo "[broken" | test_must_fail git config --list --file - >output 2>&1 &&
712-
test_cmp expect output
708+
test_i18ngrep "bad config line 1 in standard input" output
713709
'
714710

715711
cat > expect << EOF
@@ -1209,6 +1205,9 @@ test_expect_success POSIXPERM,PERL 'preserves existing permissions' '
12091205
"die q(badrename) if ((stat(q(.git/config)))[2] & 07777) != 0600"
12101206
'
12111207

1208+
! test_have_prereq MINGW ||
1209+
HOME="$(pwd)" # convert to Windows path
1210+
12121211
test_expect_success 'set up --show-origin tests' '
12131212
INCLUDE_DIR="$HOME/include" &&
12141213
mkdir -p "$INCLUDE_DIR" &&
@@ -1308,7 +1307,7 @@ test_expect_success 'set up custom config file' '
13081307
EOF
13091308
'
13101309

1311-
test_expect_success '--show-origin escape special file name characters' '
1310+
test_expect_success !MINGW '--show-origin escape special file name characters' '
13121311
cat >expect <<-\EOF &&
13131312
file:"file\" (dq) and spaces.conf" user.custom=true
13141313
EOF
@@ -1337,7 +1336,7 @@ test_expect_success '--show-origin stdin with file include' '
13371336
test_cmp expect output
13381337
'
13391338

1340-
test_expect_success '--show-origin blob' '
1339+
test_expect_success !MINGW '--show-origin blob' '
13411340
cat >expect <<-\EOF &&
13421341
blob:a9d9f9e555b5c6f07cbe09d3f06fe3df11e09c08 user.custom=true
13431342
EOF
@@ -1346,7 +1345,7 @@ test_expect_success '--show-origin blob' '
13461345
test_cmp expect output
13471346
'
13481347

1349-
test_expect_success '--show-origin blob ref' '
1348+
test_expect_success !MINGW '--show-origin blob ref' '
13501349
cat >expect <<-\EOF &&
13511350
blob:"master:file\" (dq) and spaces.conf" user.custom=true
13521351
EOF

t/t9115-git-svn-dcommit-funky-renames.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ test_expect_success 'git svn rebase works inside a fresh-cloned repository' '
9393
# > to special UNICODE characters in the range 0xf000 to 0xf0ff (the
9494
# > "Private use area") when creating or accessing files.
9595
prepare_a_utf8_locale
96-
test_expect_success UTF8 'svn.pathnameencoding=cp932 new file on dcommit' '
96+
test_expect_success UTF8,!MINGW,!UTF8_NFD_TO_NFC 'svn.pathnameencoding=cp932 new file on dcommit' '
9797
LC_ALL=$a_utf8_locale &&
9898
export LC_ALL &&
9999
neq=$(printf "\201\202") &&
@@ -105,7 +105,7 @@ test_expect_success UTF8 'svn.pathnameencoding=cp932 new file on dcommit' '
105105
'
106106

107107
# See the comment on the above test for setting of LC_ALL.
108-
test_expect_success 'svn.pathnameencoding=cp932 rename on dcommit' '
108+
test_expect_success !MINGW,!UTF8_NFD_TO_NFC 'svn.pathnameencoding=cp932 rename on dcommit' '
109109
LC_ALL=$a_utf8_locale &&
110110
export LC_ALL &&
111111
inf=$(printf "\201\207") &&

0 commit comments

Comments
 (0)