git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4] git-p4: add config git-p4.pathEncoding

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Sep 2, 2015, 18:13 UTC
Message-ID
<CAPig+cSsZnoLNw+vBfHF7h7i=aDhNz0fD_Xd3zRv3RybcGKG2Q@mail.gmail.com>
In-Reply-To
<1441205853-52065-2-git-send-email-larsxschneider@gmail.com>
On Wednesday, September 2, 2015, <larsxschneider@gmail.com> wrote:
Show 14 quoted lines
> Perforce keeps the encoding of a path as given by the originating OS.
> Git expects paths encoded as UTF-8. Add a config to tell git-p4 what
> encoding Perforce had used for the paths. This encoding is used to
> transcode the paths to UTF-8. As an example, Perforce on my Windows
> box uses “cp1252” to encode path names.
>
> Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
> ---
> +test_expect_success 'start p4d' '
> +       start_p4d
> +'
> +
> +test_expect_success 'Create a repo containing iso8859-1 encoded paths' '
> +       cd "$cli" &&

Torsten, I think, mentioned previously that the 'cd' and code following should be wrapped in a subshell.

> +       ISO8859="$(printf "$ISO8859_ESCAPED")" &&
> +       echo content123 >"$ISO8859" &&
> +       p4 add "$ISO8859" &&
> +       p4 submit -d "test commit"

And, it's odd that this test doesn't "cd ..", which means that subsequent tests are running in directory $cli. Is that intentional? If so, it probably ought to be done in a more explicit and clear fashion, perhaps by having each test do "cd $cli/$git" rather than just "cd $git".

Show 41 quoted lines
> +'
> +
> +test_expect_success 'Clone repo containing iso8859-1 encoded paths without git-p4.pathEncoding' '
> +       git p4 clone --destination="$git" //depot &&
> +       test_when_finished cleanup_git &&
> +       (
> +               cd "$git" &&
> +               UTF8="$(printf "$UTF8_ESCAPED")" &&
> +               echo $UTF8 >expect &&
> +               git -c core.quotepath=false ls-files >actual &&
> +               test_must_fail test_cmp expect actual
> +       )
> +'
> +
> +test_expect_success 'Clone repo containing iso8859-1 encoded paths with git-p4.pathEncoding' '
> +
> +       test_when_finished cleanup_git &&
> +       (
> +               cd "$git" &&
> +               git init . &&
> +               git config git-p4.pathEncoding iso8859-1 &&
> +               git p4 clone --use-client-spec --destination="$git" //depot &&
> +               UTF8="$(printf "$UTF8_ESCAPED")" &&
> +               echo $UTF8 >expect &&
> +               git -c core.quotepath=false ls-files >actual &&
> +               test_cmp expect actual &&
> +               cat >expect <<-\EOF &&
> +               content123
> +               EOF
> +               cat $UTF8 >actual &&
> +               test_cmp expect actual
> +       )
> +'
> +
> +test_expect_success 'kill p4d' '
> +       kill_p4d
> +'
> +
> +test_done
> --
> 1.9.5 (Apple Git-50.3)
Previous: Junio C Hamano
Message 4 of 4 in “git-p4: add config git-p4.pathEncoding”
  1. git-p4: add config git-p4.pathEncodinglarsxschneider@gmail.com, Sep 2, 2015
  2. git-p4: add config git-p4.pathEncodinglarsxschneider@gmail.com, Sep 2, 2015
  3. Junio C HamanoSep 2, 2015
  4. Eric SunshineSep 2, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.