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

Re: [PATCH v3] git-p4: add "--path-encoding" option

From
Lars Schneider <larsxschneider@gmail.com>
Date
Sep 1, 2015, 12:47 UTC
Message-ID
<6BD3F017-37E4-4677-BCCE-D84E7031B780@gmail.com>
In-Reply-To
<55E52BA7.6020303@web.de>
On 01 Sep 2015, at 06:37, Torsten Bögershausen <tboegi@web.de> wrote:
Show 12 quoted lines
> On 01/09/15 00:10, larsxschneider@gmail.com wrote:
>> From: Lars Schneider <larsxschneider@gmail.com>
>> 
>> Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
>> ---
>>  Documentation/git-p4.txt        |  5 +++++
>>  git-p4.py                       |  6 ++++++
>>  t/t9821-git-p4-path-encoding.sh | 38 ++++++++++++++++++++++++++++++++++++++
>>  3 files changed, 49 insertions(+)
>>  create mode 100755 t/t9821-git-p4-path-encoding.sh
>> 
>> 
<snip>
Show 15 quoted lines
> 
>> +
>> +test_expect_success 'Create a repo containing iso8859-1 encoded paths' '
>> +	cd "$cli" &&
>> +
>> +	ISO8859="$(printf "$UTF8_ESCAPED" | iconv -f utf-8 -t iso8859-1)" &&
>> +	>"$ISO8859" &&
>> +	p4 add "$ISO8859" &&
>> +	p4 submit -d "test commit"
>> +'
> Sorry for being persistant,
> but you can't create files with names that  are ISO-8859-1 encoded under Mac OS,
> we end up like this:
> 
> a-%E4_o-%F6_u-%FC.txt
You are right. However, my goal is not to create a file with ISO-8859-1 characters in Mac OS. My goal is to create this file in Perforce and this approach seems to work.
Show 11 quoted lines
> 
> (And I'm still not convinced, that we need to call iconv each time we execute the TC,
> for a string that is always the same.
> The string can be converted once, and embedded in the TC:
> The following should work under Mac OS (but I don't have p4 to test it)
> 
> ISO8859_ESCAPED="a-\303\244_o-\303\266_u-\303\274.txt"
> 
> UTF8_ESCAPED="\141\055\303\203\302\244\137\157\055\303\203\302\266\137\165\055\303\203\302\274\056\164\170\164"
> 
> ISO8859=$(printf "$ISO8859_ESCAPED”)
OK. However, how about this?

UTF8_ESCAPED="a-\303\244_o-\303\266_u-\303\274.txt" ISO8859_ESCAPED="\141\55\344\137\157\55\366\137\165\55\374\56\164\170\164"

# You can generate the ISO8859_ESCAPED with the following command: # printf "$UTF8_ESCAPED" | \ # iconv -f utf-8 -t iso8859-1 | \ # xxd -ps -u -c 1 | xargs bash -c 'for v; do echo "ibase=16; obase=8; $v" | bc; done' bash | \ # tr "\n" "\\"

Show 17 quoted lines
> 
>> +
>> +test_expect_success 'Clone repo containing iso8859-1 encoded paths' '
>> +	git p4 clone --destination="$git" --path-encoding=iso8859-1 //depot &&
>> +	test_when_finished cleanup_git &&
>> +	(
>> +		cd "$git" &&
>> +		printf "$UTF8_ESCAPED\n" >expect &&
>> +		test_config core.quotepath false &&
>> +		git ls-files >actual &&
>> +		test_cmp expect actual
>> +	)
>> +'
>> 
> The ls-files can be written shorter (if we like short code)
> 
> +		git -c core.quotepath=false ls-files >actual &&
Fixed. Thank you!
Previous: Torsten BögershausenNext: Torsten Bögershausen
Message 11 of 13 in “git-p4: add "--path-encoding" option”
  1. git-p4: add "--path-encoding" optionlarsxschneider@gmail.com, Aug 31, 2015
  2. git-p4: add "--path-encoding" optionlarsxschneider@gmail.com, Aug 31, 2015
  3. Junio C HamanoAug 31, 2015
  4. Lars SchneiderSep 1, 2015
  5. Junio C HamanoSep 1, 2015
  6. Junio C HamanoSep 1, 2015
  7. Lars SchneiderSep 1, 2015
  8. Junio C HamanoSep 1, 2015
  9. Torsten BögershausenSep 1, 2015
  10. Fwd: Re: [PATCH v3] git-p4: add "--path-encoding" optionTorsten Bögershausen, Sep 1, 2015
  11. Lars SchneiderSep 1, 2015
  12. Torsten BögershausenSep 1, 2015
  13. Lars SchneiderSep 1, 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.