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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday, September 2, 2015, <larsxschneider@xxxxxxxxx> wrote:
> 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@xxxxxxxxx>
> ---
> +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".

> +'
> +
> +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)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]