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

Re: [StGIT BUG] StGIT errors out on rebasing patch deleting file with Unicode filename

From
Jakub Narebski <jnareb@gmail.com>
Date
Jun 2, 2008, 15:47 UTC
Message-ID
<200806021747.35243.jnareb@gmail.com>
In-Reply-To
<b0943d9e0806020626s3a1009d6q2a4cdb2526be9c8d@mail.gmail.com>
Dnia poniedziałek 2. czerwca 2008 15:26, Catalin Marinas napisał:
Show 25 quoted lines
> 2008/6/2 Jakub Narebski <jnareb@gmail.com>:
>> On Sun, 1 June 2008, Jakub Narebski wrote:
>>
>>> StGIT errors out on rebasing patch which deletes file with Unicode
>>> characters in filename (with characters outside US-ASCII in filename).
>>> The patch in question is patch deleting gitweb/test/* in git directory,
>>> and is present already on the 'origin' branch (the branch we rebase
>>> onto), so stg-rebase should result in an empty patch (as first patch).
>>>
>>>  "gitweb/test/M\303\244rchen" |    2 --
>>>  gitweb/test/file with spaces |    4 ----
>>>  gitweb/test/file+plus+sign   |    6 ------
>>>  3 files changed, 0 insertions(+), 12 deletions(-)
>>>  delete mode 100644 gitweb/test/Märchen
>>>  delete mode 100644 gitweb/test/file with spaces
>>>  delete mode 100644 gitweb/test/file+plus+sign
>>>
>>> I guess the error is caused by using unescaped (quoted) filename.
>>
>> You can WORKAROUND this bug by setting core.quotepath to false.  This
>> allowed me to make stg-rebase.
> 
> I can add a workaround in StGIT to actually ignore the exception
> raised by os.remove() but I don't know how to convert the quoted file
> name back to its unicode value in Python.
In Perl it is as simple as (see unquote() in gitweb/gitweb.perl)
	if ($str =~ m/^"(.*)"$/) {
		# needs unquoting
		$str = $1;
		$str =~ s/\\([^0-7]|[0-7]{1,3})/unq($1)/eg;
	}
where
	sub unq {
		#...
		if ($seq =~ m/^[0-7]{1,3}$/) {
			# octal char sequence
			return chr(oct($seq));
		} elsif (exists $es{$seq}) {
			# C escape sequence, aka character escape code
			return $es{$seq};
		}
		# quoted ordinary character
		return $seq;
Although I haven't tested this extensively.

Or you can just use '-z' switch to git-diff-tree and/or git-ls-files, to get filename without quoting (but then you use '\0' as record delimiter, not "\n").

-- 
Jakub Narebski
Poland
Previous: Catalin MarinasNext: Catalin Marinas
Message 4 of 18 in “[StGIT BUG] StGIT errors out on rebasing patch deleting file with Unicode filename”
  1. Jakub NarebskiJun 1, 2008
  2. Jakub NarebskiJun 2, 2008
  3. Catalin MarinasJun 2, 2008
  4. Jakub NarebskiJun 2, 2008
  5. Catalin MarinasJun 2, 2008
  6. Add rebase test for when upstream has deleted a non-ASCII fileKarl Hasselström, Jun 2, 2008
  7. 0/4 Handle non-ASCII filenamesKarl Hasselström, Jun 2, 2008
  8. 1/4 Add rebase test for when upstream has deleted a non-ASCII fileKarl Hasselström, Jun 2, 2008
  9. 2/4 Handle changed files with non-ASCII namesKarl Hasselström, Jun 2, 2008
  10. 3/4 Test for another filename quoting issue in tree_status()Karl Hasselström, Jun 2, 2008
  11. 4/4 Handle refresh of changed files with non-ASCII namesKarl Hasselström, Jun 2, 2008
  12. 0/4 Handle non-ASCII filenamesKarl Hasselström, Jun 3, 2008
  13. 1/4 Add rebase test for when upstream has deleted a non-ASCII fileKarl Hasselström, Jun 3, 2008
  14. 2/4 Handle changed files with non-ASCII namesKarl Hasselström, Jun 3, 2008
  15. 3/4 Test for another filename quoting issue in tree_status()Karl Hasselström, Jun 3, 2008
  16. 4/4 Handle refresh of changed files with non-ASCII namesKarl Hasselström, Jun 3, 2008
  17. Catalin MarinasJun 3, 2008
  18. Karl HasselströmJun 3, 2008

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.