Win32: support long paths
[git/mingw/4msysgit.git] / t / t2025-checkout-long-paths.sh
blobddc084c708d57927baf6037f713a1a788754fede
1 #!/bin/sh
3 test_description='checkout long paths on Windows
5 Ensures that Git for Windows can deal with long paths (>260) enabled via core.longpaths'
7 . ./test-lib.sh
9 if test_have_prereq NOT_MINGW
10 then
11 skip_all='skipping MINGW specific long paths test'
12 test_done
15 test_expect_success setup '
16 p=longpathxx && # -> 10
17 p=$p$p$p$p$p && # -> 50
18 p=$p$p$p$p$p && # -> 250
20 path=${p}/longtestfile && # -> 263 (MAX_PATH = 260)
22 blob=$(echo foobar | git hash-object -w --stdin) &&
24 printf "100644 %s 0\t%s\n" "$blob" "$path" |
25 git update-index --add --index-info &&
26 git commit -m initial -q
29 test_expect_success 'checkout of long paths without core.longpaths fails' '
30 git config core.longpaths false &&
31 test_must_fail git checkout -f 2>error &&
32 grep -q "Filename too long" error &&
33 test_path_is_missing longpa~1/longtestfile
36 test_expect_success 'checkout of long paths with core.longpaths works' '
37 git config core.longpaths true &&
38 git checkout -f &&
39 test_path_is_file longpa~1/longtestfile
42 test_expect_success 'update of long paths' '
43 echo frotz >> longpa~1/longtestfile &&
44 echo $path > expect &&
45 git ls-files -m > actual &&
46 test_cmp expect actual &&
47 git add $path &&
48 git commit -m second &&
49 git grep "frotz" HEAD -- $path
52 test_expect_success cleanup '
53 # bash cannot delete the trash dir if it contains a long path
54 # lets help cleaning up (unless in debug mode)
55 test ! -z "$debug" || rm -rf longpa~1
58 test_done