add-patch: plug a leak handling the '/' command
[alt-git.git] / t / t3006-ls-files-long.sh
blob2aaf91ebc8c323a5ce4475bb8a7e03543dc319ad
1 #!/bin/sh
3 test_description='overly long paths'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
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 &&
13 path_a=${p}_a &&
14 path_z=${p}_z &&
16 blob_a=$(echo frotz | git hash-object -w --stdin) &&
17 blob_z=$(echo nitfol | git hash-object -w --stdin) &&
19 pat="100644 %s 0\t%s\n"
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
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 &&
34 echo "$path_a" &&
35 echo "$path_z"
36 ) >expect &&
37 git ls-files >actual &&
38 test_cmp expect actual
41 test_done