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