On Thu, Aug 20, 2015 at 3:16 AM, Lars Schneider
<[email protected]> wrote:
> On 20 Aug 2015, at 06:59, Torsten Bögershausen <[email protected]> wrote:
>> On 08/19/2015 10:04 PM, [email protected] wrote:
>>> From: Lars Schneider <[email protected]>
>>> + find . | grep two/File2.txt &&
>> Should we make sure that two/File2.txt exist?
>> Then the "find | grep" feels like overkill.
>> The line
>> test -f two/File2.txt &&
>> could do the same (or do I miss something ?)
> That’s what I did first. However, I am running OS X with HFS in
> case-insensitive mode (the default). Consequently “test -f”
> doesn’t care about the case. That’s why I used “grep”.
This explanation may deserves to be recorded as an in-code comment to
make the next person who modifies the test code aware of the issue.
>>> + git ls-files > lines &&
>> and here
> I really want to make sure only one file ends up in the repo.
>
>>> + test_line_count = 1 lines
A more idiomatic way (in Git tests) to check both the file case and
the file count would be:
cat >expect <<-\EOF &&
two/File2.txt
EOF
git ls-files >actual &&
test_cmp expect actual
>>> + )
>>> +'
>>> +
>>> +test_expect_success 'Clone the repo WITH path fixing' '
>>> + client_view "//depot/One/... //client/..." &&
>>> + git p4 clone --fix-paths --use-client-spec --destination="$git"
>>> //depot/one &&
>>> + test_when_finished cleanup_git &&
>>> + (
>>> + cd "$git" &&
>>> + find . | grep TWO/file1.txt &&
>>> + find . | grep TWO/File2.txt &&
>>> + find . | grep TWO/file3.txt &&
>> Not sure about the find | grep here either.
> See answers above.
>
>>> + git ls-files > lines &&
>>> + test_line_count = 3 lines
Likewise:
cat >expect <<-\EOF &&
TWO/File2.txt
TWO/file1.txt
TWO/file3.txt
EOF
git ls-files >actual &&
test_cmp expect actual
>>> + )
>>> +'
>>> +
>>> +# It looks like P4 determines the path case based on the first file in
>>> +# lexicographical order. Please note the lower case "two" directory for all
>>> +# files triggered through the addition of "File0.txt".
>>> +test_expect_success 'Add a new file and clone the repo WITH path fixing' '
>>> + client_view "//depot/... //client/..." &&
>>> + cd "$cli" &&
>>> +
>>> + mkdir -p One/two &&
>>> + > One/two/File0.txt &&
>>> + p4 add One/two/File0.txt &&
>>> + p4 submit -d "Add file" &&
>>> + rm -rf One &&
>>> +
>>> + client_view "//depot/One/... //client/..." &&
>>> + git p4 clone --fix-paths --use-client-spec --destination="$git"
>>> //depot/one &&
>>> + test_when_finished cleanup_git &&
>>> + (
>>> + cd "$git" &&
>>> + find . | grep two/File0.txt &&
>>> + find . | grep two/file1.txt &&
>>> + find . | grep two/File2.txt &&
>>> + find . | grep two/file3.txt &&
>>> + git ls-files > lines &&
>>> + test_line_count = 4 lines
And:
cat >expect <<-\EOF &&
two/File0.txt
two/File2.txt
two/file1.txt
two/file3.txt
EOF
git ls-files >actual &&
test_cmp expect actual
>>> + )
>>> +'
>>> +
>>> +test_expect_success 'kill p4d' '
>>> + kill_p4d
>>> +'
>>> +
>>> +test_done
>>> --
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html