git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Lars Schneider <larsxschneider@gmail.com>
Cc: "Torsten Bögershausen" <tboegi@web.de>,
	"Git List" <git@vger.kernel.org>,
	"Luke Diamand" <luke@diamand.org>, "Pete Wyckoff" <pw@padd.com>,
	torarvid@gmail.com, ksaitoh560@gmail.com
Subject: Re: [PATCH v2] git-p4: fix faulty paths for case insensitive systems
Date: Thu, 20 Aug 2015 09:17:20 -0400	[thread overview]
Message-ID: <CAPig+cQ8P8BDBGCNprN4GLtZbP0MHdj08LNw2WEJ87K5Ws1AHg@mail.gmail.com> (raw)
In-Reply-To: <917E3751-4BC8-4034-9101-30C77426D81C@gmail.com>

On Thu, Aug 20, 2015 at 3:16 AM, Lars Schneider
<larsxschneider@gmail.com> wrote:
> On 20 Aug 2015, at 06:59, Torsten Bögershausen <tboegi@web.de> wrote:
>> On 08/19/2015 10:04 PM, larsxschneider@gmail.com wrote:
>>> From: Lars Schneider <larsxschneider@gmail.com>
>>> +            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
>>> --

  reply	other threads:[~2015-08-20 13:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-19 20:04 [PATCH v2] git-p4: fix faulty paths for case insensitive systems larsxschneider
2015-08-19 20:04 ` larsxschneider
2015-08-20  4:59   ` Torsten Bögershausen
2015-08-20  7:16     ` Lars Schneider
2015-08-20 13:17       ` Eric Sunshine [this message]
2015-08-20 15:55       ` Junio C Hamano
2015-08-21  8:08         ` Lars Schneider
2015-08-21  8:10           ` Eric Sunshine
2015-08-20 19:02       ` Torsten Bögershausen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPig+cQ8P8BDBGCNprN4GLtZbP0MHdj08LNw2WEJ87K5Ws1AHg@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=git@vger.kernel.org \
    --cc=ksaitoh560@gmail.com \
    --cc=larsxschneider@gmail.com \
    --cc=luke@diamand.org \
    --cc=pw@padd.com \
    --cc=tboegi@web.de \
    --cc=torarvid@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).