]> git.ipfire.org Git - thirdparty/git.git/blob - t/t3006-ls-files-long.sh
The third batch
[thirdparty/git.git] / t / t3006-ls-files-long.sh
1 #!/bin/sh
2
3 test_description='overly long paths'
4
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7
8 test_expect_success setup '
9 p=filefilefilefilefilefilefilefile &&
10 p=$p$p$p$p$p$p$p$p$p$p$p$p$p$p$p$p &&
11 p=$p$p$p$p$p$p$p$p$p$p$p$p$p$p$p$p &&
12
13 path_a=${p}_a &&
14 path_z=${p}_z &&
15
16 blob_a=$(echo frotz | git hash-object -w --stdin) &&
17 blob_z=$(echo nitfol | git hash-object -w --stdin) &&
18
19 pat="100644 %s 0\t%s\n"
20 '
21
22 test_expect_success 'overly-long path by itself is not a problem' '
23 printf "$pat" "$blob_a" "$path_a" |
24 git update-index --add --index-info &&
25 echo "$path_a" >expect &&
26 git ls-files >actual &&
27 test_cmp expect actual
28 '
29
30 test_expect_success 'overly-long path does not replace another by mistake' '
31 printf "$pat" "$blob_a" "$path_a" "$blob_z" "$path_z" |
32 git update-index --add --index-info &&
33 (
34 echo "$path_a" &&
35 echo "$path_z"
36 ) >expect &&
37 git ls-files >actual &&
38 test_cmp expect actual
39 '
40
41 test_done