All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: larsxschneider@gmail.com
Cc: git@vger.kernel.org, luke@diamand.org
Subject: Re: [PATCH] git-p4: add "--path-encoding" option
Date: Mon, 31 Aug 2015 10:40:18 -0700	[thread overview]
Message-ID: <xmqqpp23we4d.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1441035616-39128-2-git-send-email-larsxschneider@gmail.com> (larsxschneider@gmail.com's message of "Mon, 31 Aug 2015 17:40:16 +0200")

larsxschneider@gmail.com writes:

> From: Lars Schneider <larsxschneider@gmail.com>
>
> Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
> ---
>  Documentation/git-p4.txt        |  4 ++++
>  git-p4.py                       |  6 ++++++
>  t/t9821-git-p4-path-encoding.sh | 38 ++++++++++++++++++++++++++++++++++++++
>  3 files changed, 48 insertions(+)
>  create mode 100755 t/t9821-git-p4-path-encoding.sh
>
> diff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt
> index 82aa5d6..98b6c0f 100644
> --- a/Documentation/git-p4.txt
> +++ b/Documentation/git-p4.txt
> @@ -252,6 +252,10 @@ Git repository:
>  	Use a client spec to find the list of interesting files in p4.
>  	See the "CLIENT SPEC" section below.
>  
> +----path-encoding <encoding>::
> +	The encoding to use when reading p4 client paths. With this option
> +	non ASCII paths are properly stored in Git. For example, the encoding 'cp1252' is often used on Windows systems.
> +

This line is overly long.  Let AsciiDoc wrap it upon output and keep
the source within a reasonable limit (see existing lines around the
new text to see what is considered reasonable).

Do I see too many dashes before the option name, by the way, or is
it my e-mail client tricking my eyes?

> diff --git a/t/t9821-git-p4-path-encoding.sh b/t/t9821-git-p4-path-encoding.sh
> new file mode 100755
> index 0000000..f6bb79c
> --- /dev/null
> +++ b/t/t9821-git-p4-path-encoding.sh
> @@ -0,0 +1,38 @@
> +#!/bin/sh
> +
> +test_description='Clone repositories with non ASCII paths'
> +
> +. ./lib-git-p4.sh
> +
> +test_expect_success 'start p4d' '
> +	start_p4d
> +'
> +
> +test_expect_success 'Create a repo containing cp1251 encoded paths' '
> +	cd "$cli" &&
> +
> +	FILENAME="$(echo "a-¤_o-¶_u-¼.txt" | iconv -f utf-8 -t cp1252)" &&

Hmm, we'd be better off not having a bare UTF-8 sequence in the
source like this, especially when you already have the same thing
backslash-escaped in the "expect" file below.  Perhaps

	NAME="a-\303\244_o-\303\266_u-\303\274.txt" &&

	UTF8=$(printf "$NAME") &&
        CP1252=$(printf "$NAME" | iconv -t cp1252) &&
        echo "\"$UTF8\"" >expect &&

        >"$CP1252" &&
        p4 add "$CP1252" &&
        ...

or something along that line?

> +	>"$FILENAME" &&
> +	p4 add "$FILENAME" &&
> +	p4 submit -d "test"
> +'
> +
> +test_expect_success 'Clone repo containing cp1251 encoded paths' '
> +	git p4 clone --destination="$git" --path-encoding=cp1252 //depot &&
> +	test_when_finished cleanup_git &&
> +	(
> +		cd "$git" &&
> +		git init . &&
> +		cat >expect <<-\EOF &&
> +		"a-\303\244_o-\303\266_u-\303\274.txt"
> +		EOF
> +		git ls-files >actual &&
> +		test_cmp expect actual
> +	)
> +'
> +
> +test_expect_success 'kill p4d' '
> +	kill_p4d
> +'
> +
> +test_done

  reply	other threads:[~2015-08-31 17:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-31 15:40 [PATCH] git-p4: add "--path-encoding" option larsxschneider
2015-08-31 15:40 ` larsxschneider
2015-08-31 17:40   ` Junio C Hamano [this message]
2015-08-31 19:22     ` Torsten Bögershausen
2015-08-31 20:09       ` Junio C Hamano

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

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

  git send-email \
    --in-reply-to=xmqqpp23we4d.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=larsxschneider@gmail.com \
    --cc=luke@diamand.org \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.