summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/sparse-checkout.c3
-rwxr-xr-xt/t1091-sparse-checkout-builtin.sh14
2 files changed, 17 insertions, 0 deletions
diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c
index af9e3e5..3e314e3 100644
--- a/builtin/sparse-checkout.c
+++ b/builtin/sparse-checkout.c
@@ -394,6 +394,9 @@ static void strbuf_to_cone_pattern(struct strbuf *line, struct pattern_list *pl)
strbuf_trim_trailing_dir_sep(line);
+ if (strbuf_normalize_path(line))
+ die(_("could not normalize path %s"), line->buf);
+
if (!line->len)
return;
diff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-builtin.sh
index f9265de..c35cbde 100755
--- a/t/t1091-sparse-checkout-builtin.sh
+++ b/t/t1091-sparse-checkout-builtin.sh
@@ -497,4 +497,18 @@ test_expect_success BSLASHPSPEC 'pattern-checks: escaped characters' '
test_cmp list-expect list-actual
'
+test_expect_success MINGW 'cone mode replaces backslashes with slashes' '
+ git -C repo sparse-checkout set deep\\deeper1 &&
+ cat >expect <<-\EOF &&
+ /*
+ !/*/
+ /deep/
+ !/deep/*/
+ /deep/deeper1/
+ EOF
+ test_cmp expect repo/.git/info/sparse-checkout &&
+ check_files repo a deep &&
+ check_files repo/deep a deeper1
+'
+
test_done