git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / Atom feed
* Re: git-bugreport-2021-01-06-1209.txt (git can't deal with special characters)
@ 2021-01-08 19:56 Daniel Troger
  2021-01-09 17:23 ` Torsten Bögershausen
  0 siblings, 1 reply; 14+ messages in thread
From: Daniel Troger @ 2021-01-08 19:56 UTC (permalink / raw)
  To: Torsten Bögershausen
  Cc: Philippe Blain, Randall S. Becker, git, Johannes Schindelin

> That did the trick, the test case is now reproducible here.

> It seems as if there could be a patch in a couple of days, but no promises.

That's great news, thank you all very much!

I was already afraid at first it was some weird macOS filesystem bug only happening on high sierra and earlier which was never going to be fixed.

In the meantime I have managed to add "both directories" to git (with git add paulbr*). It's funny, now one directory shows up twice when viewing my repo on gitlab.

And this is the message I get when cloning:
warning: the following paths have collided (e.g. case-sensitive paths
on a case-insensitive filesystem) and only one from the same
colliding group is in the working tree:
  '[...]/paulbrunngård-springyard/main.ts'
  '[...]/paulbrunngård-springyard/main.ts'

What will happen with the two folders in the git repo after the patch?


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-bugreport-2021-01-06-1209.txt (git can't deal with special characters)
  2021-01-08 19:56 git-bugreport-2021-01-06-1209.txt (git can't deal with special characters) Daniel Troger
@ 2021-01-09 17:23 ` Torsten Bögershausen
  2021-01-13 14:57   ` Daniel Troger
  0 siblings, 1 reply; 14+ messages in thread
From: Torsten Bögershausen @ 2021-01-09 17:23 UTC (permalink / raw)
  To: Daniel Troger; +Cc: Philippe Blain, Randall S. Becker, git, Johannes Schindelin

On Fri, Jan 08, 2021 at 08:56:08PM +0100, Daniel Troger wrote:
> > That did the trick, the test case is now reproducible here.
>
> > It seems as if there could be a patch in a couple of days, but no promises.
>
> That's great news, thank you all very much!

Hej Daniel,
Not sure if I can keep my promise, please see below.

> I was already afraid at first it was some weird macOS filesystem bug only happening on high sierra
> and earlier which was never going to be fixed.

I haven't heard about anything special about Mac OS High Sierra.
If there are strange things, please let us know.

(And I still womder, how did you mange to create the "decomposed version of å" ?
 Mac OS itself doesn't decompose the "å", in opposite to "ä" or "ö".
 It creates a name for a file in decomposed form for "ä", "ö" and a lot of other
 characters/code points, but not for "å".
 It does, however, treat the pre- and de-composed form of "å" equivilent)

>
> In the meantime I have managed to add "both directories" to git (with git add paulbr*).
> It's funny, now one directory shows up twice when viewing my repo on gitlab.
>
> And this is the message I get when cloning:
> warning: the following paths have collided (e.g. case-sensitive paths
> on a case-insensitive filesystem) and only one from the same
> colliding group is in the working tree:
>   '[...]/paulbrunngård-springyard/main.ts'
>   '[...]/paulbrunngård-springyard/main.ts'
>
> What will happen with the two folders in the git repo after the patch?
>

Now, that is another question.

First of all, I would recommend to "remove" one of the folders from Git,
because all files are tracked twice in Git, but "shadowed" by the file system.



To clean up the repo, you can do like this, explained in a dummy repo:

#One file (that is all we have) is tracked twice:
user@mac:/tmp/AAA> git ls-files
"paulbrunnga\314\212rd-springyard/horse"
"paulbrunng\303\245rd-springyard/horse"

# Remove all files from Git, but keep them on disk:
user@mac:/tmp/AAA> git rm -rf --cached .
rm 'paulbrunngård-springyard/horse'
rm 'paulbrunngård-springyard/horse'

# Re-add one version, the precomposed:
user@mac:/tmp/AAA> git add .
user@mac:/tmp/AAA> git status
On branch master
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
          deleted:    "paulbrunnga\314\212rd-springyard/horse"

user@mac:/tmp/AAA> git ls-files
"paulbrunng\303\245rd-springyard/horse"

#Not shown:
git commit -m "Remove duplicate directory"

####################

Now back to a potential patch:
That will take some time.
I digged some hours into the stuff, add lots of debug traces,
patches and stuff, and now we need a cleanup and get it into a better
shape to be acceptable.

All the best

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-bugreport-2021-01-06-1209.txt (git can't deal with special characters)
  2021-01-09 17:23 ` Torsten Bögershausen
@ 2021-01-13 14:57   ` Daniel Troger
  2021-01-16 17:24     ` Torsten Bögershausen
  0 siblings, 1 reply; 14+ messages in thread
From: Daniel Troger @ 2021-01-13 14:57 UTC (permalink / raw)
  To: Torsten Bögershausen
  Cc: Philippe Blain, Randall S. Becker, git, Johannes Schindelin

Hej Torsten, 

> To clean up the repo, you can do like this, explained in a dummy repo: 

your commands to remove one of the versions worked perfectly, thanks!

> And I still womder, how did you mange to create the "decomposed version of å" ?

I created the directory with finder or atom I suppose, I did not find an mkdir command for that directory in my 290MB of bash history.

> I digged some hours into the stuff, add lots of debug traces, patches and stuff

If I understand correctly, you already came up with a patch? That's great news! It's fine if it takes time as long as it gets fixed eventually.

Best regards

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-bugreport-2021-01-06-1209.txt (git can't deal with special characters)
  2021-01-13 14:57   ` Daniel Troger
@ 2021-01-16 17:24     ` Torsten Bögershausen
  0 siblings, 0 replies; 14+ messages in thread
From: Torsten Bögershausen @ 2021-01-16 17:24 UTC (permalink / raw)
  To: Daniel Troger; +Cc: Philippe Blain, Randall S. Becker, git, Johannes Schindelin

On Wed, Jan 13, 2021 at 03:57:03PM +0100, Daniel Troger wrote:
> Hej Torsten,
>
> > To clean up the repo, you can do like this, explained in a dummy repo:
>
> your commands to remove one of the versions worked perfectly, thanks!
>
> > And I still womder, how did you mange to create the "decomposed version of å" ?
>
> I created the directory with finder or atom I suppose, I did not find an mkdir command for that directory in my 290MB of bash history.
>
> > I digged some hours into the stuff, add lots of debug traces, patches and stuff
>
> If I understand correctly, you already came up with a patch? That's great news! It's fine if it takes time as long as it gets fixed eventually.

That is a more tricky thing than I thought.
When Git starts, it runs getcwd() to find out where you started.
Inside that whole path there is the Git repo to be found, and the whole
path split into to parts:
The part pointing out the repo and
the part inside the repo.

This is done in setup.c, and it seems as if we need to precompose the whole
path, to work correctly.

However, the configuration saying "core.precomposeunicode" has not been read yet.

And setup.c doesn't know, where to find it, that is my understanding.

When I patch the getcwd() function to try to read the configuration,
it doesn't find it (yet).

It can find the global (or system) config.
Technically speaking, that can be used, but will probably cause other problems,
since sometimes the (repo) local configuration is different, sometimes not.

As far as I understand today, the best thing we can do is to check,
if getcwd() may need a precomposition: precompose and see if
the result is different.

Then error out, telling the user that you can not run Git inside
this directory.

I don't know, if this is worth the effort.

But: If somebody comes up with a patch, I am happy to review it
and/or get it into shape.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-bugreport-2021-01-06-1209.txt (git can't deal with special characters)
  2021-01-07 16:21               ` Philippe Blain
@ 2021-01-08 19:07                 ` Torsten Bögershausen
  0 siblings, 0 replies; 14+ messages in thread
From: Torsten Bögershausen @ 2021-01-08 19:07 UTC (permalink / raw)
  To: Philippe Blain
  Cc: Randall S. Becker, 'Daniel Troger', git, Johannes Schindelin

On Thu, Jan 07, 2021 at 11:21:56AM -0500, Philippe Blain wrote:
> Hi Torsten,

[snip]

>
> change to:
> FILENAME=file
>
> >
> > rm -rf $DIR &&
> >      mkdir $DIR &&
> >      cd $DIR &&
> >      $GIT init &&
> >      mkdir $DIRNAME &&
>
> add:
> cd $DIRNAME &&
>
> >      echo "Initial" >$FILENAME &&
[]

That did the trick, the test case is now reproducible here.

I am looking into the stuff, somewhere inside the pathspec machinery,
determinating a "prefix" and using xgetcwd we need a precompose_string.
But only if core.precomposeunicode is true.

And I am still digging.
It seems as if there could be a patch in a couple of days, but no promises.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-bugreport-2021-01-06-1209.txt (git can't deal with special characters)
  2021-01-07 15:49             ` Torsten Bögershausen
@ 2021-01-07 16:21               ` Philippe Blain
  2021-01-08 19:07                 ` Torsten Bögershausen
  0 siblings, 1 reply; 14+ messages in thread
From: Philippe Blain @ 2021-01-07 16:21 UTC (permalink / raw)
  To: Torsten Bögershausen
  Cc: Randall S. Becker, 'Daniel Troger', git, Johannes Schindelin

Hi Torsten,

Le 2021-01-07 à 10:49, Torsten Bögershausen a écrit :
> On Thu, Jan 07, 2021 at 09:34:35AM -0500, Philippe Blain wrote:
>> Hi everyone,
>>
>> Le 2021-01-06 à 18:07, Randall S. Becker a écrit :
>>> On January 6, 2021 5:22 PM, Daniel Troger wrote:
>>>> Hi, maybe this helps you reproduce. I think I should have committed before
>>>> doing the second changes but I still got the error message and the two
>>>> names for one folder:
>>>>
>>>> me@iMac:/tmp$ mkdir git_bug
>>>> me@iMac:/tmp$ cd git_bug
>>>> me@iMac:/tmp/git_bug$ git init
>>>> hint: Using 'master' as the name for the initial branch. This default branch
>>>> name
>>>> hint: is subject to change. To configure the initial branch name to use in all
>>>> hint: of your new repositories, which will suppress this warning, call:
>>>> hint:
>>>> hint: 	git config --global init.defaultBranch <name>
>>>> hint:
>>>> hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
>>>> hint: 'development'. The just-created branch can be renamed via this
>>>> command:
>>>> hint:
>>>> hint: 	git branch -m <name>
>>>> Initialized empty Git repository in /private/tmp/git_bug/.git/
>>>> me@iMac:/tmp/git_bug$ ls -la total 8
>>>> drwxr-xr-x   4 daniel  wheel   128 Jan  6 23:13 .
>>>> drwxrwxrwt  27 root    wheel   864 Jan  6 23:13 ..
>>>> drwxr-xr-x   9 daniel  wheel   288 Jan  6 23:12 .git
>>>> -rw-r--r--@  1 daniel  staff  1283 Jan  6 23:13 paulbrunngård-springyard.zip
>>>> me@iMac:/tmp/git_bug$ unzip paulbrunngård-springyard.zip
>>>> Archive:  paulbrunngård-springyard.zip
>>>>      creating: paulbrunnga??rd-springyard/
>>>>     inflating: paulbrunnga??rd-springyard/.DS_Store
>>>>      creating: __MACOSX/
>>>>      creating: __MACOSX/paulbrunnga??rd-springyard/
>>>>     inflating: __MACOSX/paulbrunnga??rd-springyard/._.DS_Store
>>>>    extracting: paulbrunnga??rd-springyard/empty me@iMac:/tmp/git_bug$ rm
>>>> -rf __MACOSX/ *.zip me@iMac:/tmp/git_bug$ ls -la total 0
>>>> drwxr-xr-x   4 daniel  wheel  128 Jan  6 23:15 .
>>>> drwxrwxrwt  27 root    wheel  864 Jan  6 23:13 ..
>>>> drwxr-xr-x   9 daniel  wheel  288 Jan  6 23:15 .git
>>>> drwxr-xr-x@  4 daniel  wheel  128 Jan  6 12:20 paulbrunngård-springyard
>>>> me@iMac:/tmp/git_bug$ cd paulbrunngård-springyard/
>>>> me@iMac:/tmp/git_bug/paulbrunngård-springyard$ nano empty
>>>> me@iMac:/tmp/git_bug/paulbrunngård-springyard$ cat empty Initial
>>>> content me@iMac:/tmp/git_bug/paulbrunngård-springyard$ git add empty
>>>> me@iMac:/tmp/git_bug/paulbrunngård-springyard$ nano empty
>>>> me@iMac:/tmp/git_bug/paulbrunngård-springyard$ cat empty Initial
>>>> content
>>>>
>>>>
>>>> Line I want to keep
>>>>
>>>> Line I want gone
>>>> me@iMac:/tmp/git_bug/paulbrunngård-springyard$ git restore -p .
>>>> BUG: pathspec.c:495: error initializing pathspec_item Cannot close git diff-
>>>> index --cached --numstat --summary
>>>> 4b825dc642cb6eb9a060e54bf8d69288fbee4904 --
>>>> :(,prefix:27)paulbrunngård-springyard/ () at
>>>> /usr/local/Cellar/git/2.30.0/libexec/git-core/git-add--interactive line 183.
>>>> me@iMac:/tmp/git_bug/paulbrunngård-springyard$ cd ..
>>>> me@iMac:/tmp/git_bug$ git status
>>>> On branch master
>>>>
>>>> No commits yet
>>>>
>>>> Changes to be committed:
>>>>     (use "git rm --cached <file>..." to unstage)
>>>> 	new file:   "paulbrunnga\314\212rd-springyard/empty"
>>>>
>>>> Changes not staged for commit:
>>>>     (use "git add <file>..." to update what will be committed)
>>>>     (use "git restore <file>..." to discard changes in working directory)
>>>> 	modified:   "paulbrunnga\314\212rd-springyard/empty"
>>>>
>>>> Untracked files:
>>>>     (use "git add <file>..." to include in what will be committed)
>>>> 	.DS_Store
>>>> 	"paulbrunng\303\245rd-springyard/"
>>>>
>>>> me@iMac:/tmp/git_bug$
>>>
>>> Is it possible that the å character is coming from a UTF-16 encoding and is not representable in UTF-8? I'm wondering whether the name has a double-byte representation where one of the bytes is null, resulting in a truncated file name coming from readdir(). The file name would not be representable on some platforms that do not support UTF-16 path names.
>>
>> I don't think that's the case (the angstrom is present in UTF-8 [1]).
>> I think it's another UTF-8 precomposed/decomposed bug. As far as I
>> was able to test it happens as soon as you have a precomposed character
>> in the folder name. I observed the same behaviour with a folder named
>> "folderü", for example. I also tried 'git -c add.interactive.usebuiltin restore -p .'
>> to see if the new experimental builtin§ add-interactive has the same problem,
>> and it does (though the error is less verbose).
>>
>> Anyway as you show with 'git status', it's not just 'git add -p' that is
>> faulty, it's deeper than that, I would say.
>>
>> Cheers,
>>
>> Philippe.
>>
>> [1] https://en.wikipedia.org/wiki/%C3%85#On_computers
> 
> Folks, I can not reproduce anything here.
> - The zip file mentioned earlier does not include a decomposed "å"
>    Neither when running unzip under Linux nor under Mac
> - Trying to write a test script does not show anything special
> 
> My attempt looks like this:

With a few modifications, you should see things start to get strange:

> cat test.sh
> #!/bin/sh
> DIR=git-test-restore-p
> GIT=/usr/local/bin/git
> 
> Adiarnfc=$(printf '\303\204')
> Adiarnfd=$(printf 'A\314\210')
> DIRNAME=xx${Adiarnfd}yy
> FILENAME=$DIRNAME/file

change to:
FILENAME=file

> 
> rm -rf $DIR &&
>      mkdir $DIR &&
>      cd $DIR &&
>      $GIT init &&
>      mkdir $DIRNAME &&

add:
cd $DIRNAME &&

>      echo "Initial" >$FILENAME &&

add:
$GIT status &&

>      $GIT add $FILENAME &&

add:
$GIT status &&

>      echo  >>$FILENAME &&
>      echo  >>$FILENAME &&
>      echo "One more line"  >>$FILENAME &&
>      echo  >>$FILENAME &&
>      echo  >>$FILENAME &&
>      echo "Last line"  >$FILENAME &&

add:
$GIT status &&

>      $GIT restore -p . &&
>      $GIT restore -p . &&
>      echo git=$GIT &&
>      $GIT --version &&
>      echo "OK"
> 
> ==================================
> It points out Git from brew, I think.

I don't think it's a packaging bug;
I tried with /usr/bin/git on macOS 10.11 (git version 2.10.1 (Apple Git-78))
and I also get a (different) error but the command does not fail
(I needed to change restore to reset):

$ ./test.sh
Initialized empty Git repository in /private/var/folders/lr/r6n2057j0dzd4gdb614fp0740000gp/T/repro/git-test-restore-p/.git/
Assertion failed: (item->nowildcard_len <= item->len && item->prefix <= item->len), function prefix_pathspec, file pathspec.c, line 317.
No changes.
Assertion failed: (item->nowildcard_len <= item->len && item->prefix <= item->len), function prefix_pathspec, file pathspec.c, line 317.
No changes.
git=/usr/bin/git
git version 2.10.1 (Apple Git-78)
OK


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-bugreport-2021-01-06-1209.txt (git can't deal with special characters)
  2021-01-07 14:34           ` Philippe Blain
@ 2021-01-07 15:49             ` Torsten Bögershausen
  2021-01-07 16:21               ` Philippe Blain
  0 siblings, 1 reply; 14+ messages in thread
From: Torsten Bögershausen @ 2021-01-07 15:49 UTC (permalink / raw)
  To: Philippe Blain
  Cc: Randall S. Becker, 'Daniel Troger', git, Johannes Schindelin

On Thu, Jan 07, 2021 at 09:34:35AM -0500, Philippe Blain wrote:
> Hi everyone,
>
> Le 2021-01-06 à 18:07, Randall S. Becker a écrit :
> > On January 6, 2021 5:22 PM, Daniel Troger wrote:
> > > Hi, maybe this helps you reproduce. I think I should have committed before
> > > doing the second changes but I still got the error message and the two
> > > names for one folder:
> > >
> > > me@iMac:/tmp$ mkdir git_bug
> > > me@iMac:/tmp$ cd git_bug
> > > me@iMac:/tmp/git_bug$ git init
> > > hint: Using 'master' as the name for the initial branch. This default branch
> > > name
> > > hint: is subject to change. To configure the initial branch name to use in all
> > > hint: of your new repositories, which will suppress this warning, call:
> > > hint:
> > > hint: 	git config --global init.defaultBranch <name>
> > > hint:
> > > hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
> > > hint: 'development'. The just-created branch can be renamed via this
> > > command:
> > > hint:
> > > hint: 	git branch -m <name>
> > > Initialized empty Git repository in /private/tmp/git_bug/.git/
> > > me@iMac:/tmp/git_bug$ ls -la total 8
> > > drwxr-xr-x   4 daniel  wheel   128 Jan  6 23:13 .
> > > drwxrwxrwt  27 root    wheel   864 Jan  6 23:13 ..
> > > drwxr-xr-x   9 daniel  wheel   288 Jan  6 23:12 .git
> > > -rw-r--r--@  1 daniel  staff  1283 Jan  6 23:13 paulbrunngård-springyard.zip
> > > me@iMac:/tmp/git_bug$ unzip paulbrunngård-springyard.zip
> > > Archive:  paulbrunngård-springyard.zip
> > >     creating: paulbrunnga??rd-springyard/
> > >    inflating: paulbrunnga??rd-springyard/.DS_Store
> > >     creating: __MACOSX/
> > >     creating: __MACOSX/paulbrunnga??rd-springyard/
> > >    inflating: __MACOSX/paulbrunnga??rd-springyard/._.DS_Store
> > >   extracting: paulbrunnga??rd-springyard/empty me@iMac:/tmp/git_bug$ rm
> > > -rf __MACOSX/ *.zip me@iMac:/tmp/git_bug$ ls -la total 0
> > > drwxr-xr-x   4 daniel  wheel  128 Jan  6 23:15 .
> > > drwxrwxrwt  27 root    wheel  864 Jan  6 23:13 ..
> > > drwxr-xr-x   9 daniel  wheel  288 Jan  6 23:15 .git
> > > drwxr-xr-x@  4 daniel  wheel  128 Jan  6 12:20 paulbrunngård-springyard
> > > me@iMac:/tmp/git_bug$ cd paulbrunngård-springyard/
> > > me@iMac:/tmp/git_bug/paulbrunngård-springyard$ nano empty
> > > me@iMac:/tmp/git_bug/paulbrunngård-springyard$ cat empty Initial
> > > content me@iMac:/tmp/git_bug/paulbrunngård-springyard$ git add empty
> > > me@iMac:/tmp/git_bug/paulbrunngård-springyard$ nano empty
> > > me@iMac:/tmp/git_bug/paulbrunngård-springyard$ cat empty Initial
> > > content
> > >
> > >
> > > Line I want to keep
> > >
> > > Line I want gone
> > > me@iMac:/tmp/git_bug/paulbrunngård-springyard$ git restore -p .
> > > BUG: pathspec.c:495: error initializing pathspec_item Cannot close git diff-
> > > index --cached --numstat --summary
> > > 4b825dc642cb6eb9a060e54bf8d69288fbee4904 --
> > > :(,prefix:27)paulbrunngård-springyard/ () at
> > > /usr/local/Cellar/git/2.30.0/libexec/git-core/git-add--interactive line 183.
> > > me@iMac:/tmp/git_bug/paulbrunngård-springyard$ cd ..
> > > me@iMac:/tmp/git_bug$ git status
> > > On branch master
> > >
> > > No commits yet
> > >
> > > Changes to be committed:
> > >    (use "git rm --cached <file>..." to unstage)
> > > 	new file:   "paulbrunnga\314\212rd-springyard/empty"
> > >
> > > Changes not staged for commit:
> > >    (use "git add <file>..." to update what will be committed)
> > >    (use "git restore <file>..." to discard changes in working directory)
> > > 	modified:   "paulbrunnga\314\212rd-springyard/empty"
> > >
> > > Untracked files:
> > >    (use "git add <file>..." to include in what will be committed)
> > > 	.DS_Store
> > > 	"paulbrunng\303\245rd-springyard/"
> > >
> > > me@iMac:/tmp/git_bug$
> >
> > Is it possible that the å character is coming from a UTF-16 encoding and is not representable in UTF-8? I'm wondering whether the name has a double-byte representation where one of the bytes is null, resulting in a truncated file name coming from readdir(). The file name would not be representable on some platforms that do not support UTF-16 path names.
>
> I don't think that's the case (the angstrom is present in UTF-8 [1]).
> I think it's another UTF-8 precomposed/decomposed bug. As far as I
> was able to test it happens as soon as you have a precomposed character
> in the folder name. I observed the same behaviour with a folder named
> "folderü", for example. I also tried 'git -c add.interactive.usebuiltin restore -p .'
> to see if the new experimental builtin§ add-interactive has the same problem,
> and it does (though the error is less verbose).
>
> Anyway as you show with 'git status', it's not just 'git add -p' that is
> faulty, it's deeper than that, I would say.
>
> Cheers,
>
> Philippe.
>
> [1] https://en.wikipedia.org/wiki/%C3%85#On_computers

Folks, I can not reproduce anything here.
- The zip file mentioned earlier does not include a decomposed "å"
  Neither when running unzip under Linux nor under Mac
- Trying to write a test script does not show anything special

My attempt looks like this:
cat test.sh
#!/bin/sh
DIR=git-test-restore-p
GIT=/usr/local/bin/git

Adiarnfc=$(printf '\303\204')
Adiarnfd=$(printf 'A\314\210')
DIRNAME=xx${Adiarnfd}yy
FILENAME=$DIRNAME/file

rm -rf $DIR &&
    mkdir $DIR &&
    cd $DIR &&
    $GIT init &&
    mkdir $DIRNAME &&
    echo "Initial" >$FILENAME &&
    $GIT add $FILENAME &&
    echo  >>$FILENAME &&
    echo  >>$FILENAME &&
    echo "One more line"  >>$FILENAME &&
    echo  >>$FILENAME &&
    echo  >>$FILENAME &&
    echo "Last line"  >$FILENAME &&
    $GIT restore -p . &&
    $GIT restore -p . &&
    echo git=$GIT &&
    $GIT --version &&
    echo "OK"

==================================
It points out Git from brew, I think.
And running it (using a decomposed Ä instead of å or ü)
shows nothing strange, please see below.

Is anybody able to provide a shell-script, that does reproduce ?
Excuse my bad shell-programming style, this is for demo only.

hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint:   git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint:   git branch -m <name>
Initialized empty Git repository in ..../2021-01-07-git_decompose_test/git-test-restore-p/.git/
diff --git a/xxÄyy/file b/xxÄyy/file
index a77fa51..8ea8e21 100644
--- a/xxÄyy/file
+++ b/xxÄyy/file
@@ -1 +1 @@
-Initial
+Last line
(1/1) Discard this hunk from worktree [y,n,q,a,d,e,?]? y

No changes.
git=/usr/local/bin/git
git version 2.30.0
OK


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-bugreport-2021-01-06-1209.txt (git can't deal with special characters)
  2021-01-06 23:07         ` Randall S. Becker
@ 2021-01-07 14:34           ` Philippe Blain
  2021-01-07 15:49             ` Torsten Bögershausen
  0 siblings, 1 reply; 14+ messages in thread
From: Philippe Blain @ 2021-01-07 14:34 UTC (permalink / raw)
  To: Randall S. Becker, 'Daniel Troger',
	'Torsten Bögershausen'
  Cc: git, Johannes Schindelin

Hi everyone,

Le 2021-01-06 à 18:07, Randall S. Becker a écrit :
> On January 6, 2021 5:22 PM, Daniel Troger wrote:
>> Hi, maybe this helps you reproduce. I think I should have committed before
>> doing the second changes but I still got the error message and the two
>> names for one folder:
>>
>> me@iMac:/tmp$ mkdir git_bug
>> me@iMac:/tmp$ cd git_bug
>> me@iMac:/tmp/git_bug$ git init
>> hint: Using 'master' as the name for the initial branch. This default branch
>> name
>> hint: is subject to change. To configure the initial branch name to use in all
>> hint: of your new repositories, which will suppress this warning, call:
>> hint:
>> hint: 	git config --global init.defaultBranch <name>
>> hint:
>> hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
>> hint: 'development'. The just-created branch can be renamed via this
>> command:
>> hint:
>> hint: 	git branch -m <name>
>> Initialized empty Git repository in /private/tmp/git_bug/.git/
>> me@iMac:/tmp/git_bug$ ls -la total 8
>> drwxr-xr-x   4 daniel  wheel   128 Jan  6 23:13 .
>> drwxrwxrwt  27 root    wheel   864 Jan  6 23:13 ..
>> drwxr-xr-x   9 daniel  wheel   288 Jan  6 23:12 .git
>> -rw-r--r--@  1 daniel  staff  1283 Jan  6 23:13 paulbrunngård-springyard.zip
>> me@iMac:/tmp/git_bug$ unzip paulbrunngård-springyard.zip
>> Archive:  paulbrunngård-springyard.zip
>>     creating: paulbrunnga??rd-springyard/
>>    inflating: paulbrunnga??rd-springyard/.DS_Store
>>     creating: __MACOSX/
>>     creating: __MACOSX/paulbrunnga??rd-springyard/
>>    inflating: __MACOSX/paulbrunnga??rd-springyard/._.DS_Store
>>   extracting: paulbrunnga??rd-springyard/empty me@iMac:/tmp/git_bug$ rm
>> -rf __MACOSX/ *.zip me@iMac:/tmp/git_bug$ ls -la total 0
>> drwxr-xr-x   4 daniel  wheel  128 Jan  6 23:15 .
>> drwxrwxrwt  27 root    wheel  864 Jan  6 23:13 ..
>> drwxr-xr-x   9 daniel  wheel  288 Jan  6 23:15 .git
>> drwxr-xr-x@  4 daniel  wheel  128 Jan  6 12:20 paulbrunngård-springyard
>> me@iMac:/tmp/git_bug$ cd paulbrunngård-springyard/
>> me@iMac:/tmp/git_bug/paulbrunngård-springyard$ nano empty
>> me@iMac:/tmp/git_bug/paulbrunngård-springyard$ cat empty Initial
>> content me@iMac:/tmp/git_bug/paulbrunngård-springyard$ git add empty
>> me@iMac:/tmp/git_bug/paulbrunngård-springyard$ nano empty
>> me@iMac:/tmp/git_bug/paulbrunngård-springyard$ cat empty Initial
>> content
>>
>>
>> Line I want to keep
>>
>> Line I want gone
>> me@iMac:/tmp/git_bug/paulbrunngård-springyard$ git restore -p .
>> BUG: pathspec.c:495: error initializing pathspec_item Cannot close git diff-
>> index --cached --numstat --summary
>> 4b825dc642cb6eb9a060e54bf8d69288fbee4904 --
>> :(,prefix:27)paulbrunngård-springyard/ () at
>> /usr/local/Cellar/git/2.30.0/libexec/git-core/git-add--interactive line 183.
>> me@iMac:/tmp/git_bug/paulbrunngård-springyard$ cd ..
>> me@iMac:/tmp/git_bug$ git status
>> On branch master
>>
>> No commits yet
>>
>> Changes to be committed:
>>    (use "git rm --cached <file>..." to unstage)
>> 	new file:   "paulbrunnga\314\212rd-springyard/empty"
>>
>> Changes not staged for commit:
>>    (use "git add <file>..." to update what will be committed)
>>    (use "git restore <file>..." to discard changes in working directory)
>> 	modified:   "paulbrunnga\314\212rd-springyard/empty"
>>
>> Untracked files:
>>    (use "git add <file>..." to include in what will be committed)
>> 	.DS_Store
>> 	"paulbrunng\303\245rd-springyard/"
>>
>> me@iMac:/tmp/git_bug$
> 
> Is it possible that the å character is coming from a UTF-16 encoding and is not representable in UTF-8? I'm wondering whether the name has a double-byte representation where one of the bytes is null, resulting in a truncated file name coming from readdir(). The file name would not be representable on some platforms that do not support UTF-16 path names.

I don't think that's the case (the angstrom is present in UTF-8 [1]).
I think it's another UTF-8 precomposed/decomposed bug. As far as I
was able to test it happens as soon as you have a precomposed character
in the folder name. I observed the same behaviour with a folder named
"folderü", for example. I also tried 'git -c add.interactive.usebuiltin restore -p .'
to see if the new experimental builtin add-interactive has the same problem,
and it does (though the error is less verbose).

Anyway as you show with 'git status', it's not just 'git add -p' that is
faulty, it's deeper than that, I would say.

Cheers,

Philippe.

[1] https://en.wikipedia.org/wiki/%C3%85#On_computers

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: git-bugreport-2021-01-06-1209.txt (git can't deal with special characters)
  2021-01-06 22:21       ` Daniel Troger
@ 2021-01-06 23:07         ` Randall S. Becker
  2021-01-07 14:34           ` Philippe Blain
  0 siblings, 1 reply; 14+ messages in thread
From: Randall S. Becker @ 2021-01-06 23:07 UTC (permalink / raw)
  To: 'Daniel Troger', 'Torsten Bögershausen'; +Cc: git

On January 6, 2021 5:22 PM, Daniel Troger wrote:
> Hi, maybe this helps you reproduce. I think I should have committed before
> doing the second changes but I still got the error message and the two
> names for one folder:
> 
> me@iMac:/tmp$ mkdir git_bug
> me@iMac:/tmp$ cd git_bug
> me@iMac:/tmp/git_bug$ git init
> hint: Using 'master' as the name for the initial branch. This default branch
> name
> hint: is subject to change. To configure the initial branch name to use in all
> hint: of your new repositories, which will suppress this warning, call:
> hint:
> hint: 	git config --global init.defaultBranch <name>
> hint:
> hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
> hint: 'development'. The just-created branch can be renamed via this
> command:
> hint:
> hint: 	git branch -m <name>
> Initialized empty Git repository in /private/tmp/git_bug/.git/
> me@iMac:/tmp/git_bug$ ls -la total 8
> drwxr-xr-x   4 daniel  wheel   128 Jan  6 23:13 .
> drwxrwxrwt  27 root    wheel   864 Jan  6 23:13 ..
> drwxr-xr-x   9 daniel  wheel   288 Jan  6 23:12 .git
> -rw-r--r--@  1 daniel  staff  1283 Jan  6 23:13 paulbrunngård-springyard.zip
> me@iMac:/tmp/git_bug$ unzip paulbrunngård-springyard.zip
> Archive:  paulbrunngård-springyard.zip
>    creating: paulbrunnga??rd-springyard/
>   inflating: paulbrunnga??rd-springyard/.DS_Store
>    creating: __MACOSX/
>    creating: __MACOSX/paulbrunnga??rd-springyard/
>   inflating: __MACOSX/paulbrunnga??rd-springyard/._.DS_Store
>  extracting: paulbrunnga??rd-springyard/empty me@iMac:/tmp/git_bug$ rm
> -rf __MACOSX/ *.zip me@iMac:/tmp/git_bug$ ls -la total 0
> drwxr-xr-x   4 daniel  wheel  128 Jan  6 23:15 .
> drwxrwxrwt  27 root    wheel  864 Jan  6 23:13 ..
> drwxr-xr-x   9 daniel  wheel  288 Jan  6 23:15 .git
> drwxr-xr-x@  4 daniel  wheel  128 Jan  6 12:20 paulbrunngård-springyard
> me@iMac:/tmp/git_bug$ cd paulbrunngård-springyard/
> me@iMac:/tmp/git_bug/paulbrunngård-springyard$ nano empty
> me@iMac:/tmp/git_bug/paulbrunngård-springyard$ cat empty Initial
> content me@iMac:/tmp/git_bug/paulbrunngård-springyard$ git add empty
> me@iMac:/tmp/git_bug/paulbrunngård-springyard$ nano empty
> me@iMac:/tmp/git_bug/paulbrunngård-springyard$ cat empty Initial
> content
> 
> 
> Line I want to keep
> 
> Line I want gone
> me@iMac:/tmp/git_bug/paulbrunngård-springyard$ git restore -p .
> BUG: pathspec.c:495: error initializing pathspec_item Cannot close git diff-
> index --cached --numstat --summary
> 4b825dc642cb6eb9a060e54bf8d69288fbee4904 --
> :(,prefix:27)paulbrunngård-springyard/ () at
> /usr/local/Cellar/git/2.30.0/libexec/git-core/git-add--interactive line 183.
> me@iMac:/tmp/git_bug/paulbrunngård-springyard$ cd ..
> me@iMac:/tmp/git_bug$ git status
> On branch master
> 
> No commits yet
> 
> Changes to be committed:
>   (use "git rm --cached <file>..." to unstage)
> 	new file:   "paulbrunnga\314\212rd-springyard/empty"
> 
> Changes not staged for commit:
>   (use "git add <file>..." to update what will be committed)
>   (use "git restore <file>..." to discard changes in working directory)
> 	modified:   "paulbrunnga\314\212rd-springyard/empty"
> 
> Untracked files:
>   (use "git add <file>..." to include in what will be committed)
> 	.DS_Store
> 	"paulbrunng\303\245rd-springyard/"
> 
> me@iMac:/tmp/git_bug$

Is it possible that the å character is coming from a UTF-16 encoding and is not representable in UTF-8? I'm wondering whether the name has a double-byte representation where one of the bytes is null, resulting in a truncated file name coming from readdir(). The file name would not be representable on some platforms that do not support UTF-16 path names.

Regards,
Randall

-- Brief whoami:
 NonStop developer since approximately 211288444200000000
 UNIX developer since approximately 421664400
-- In my real life, I talk too much.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-bugreport-2021-01-06-1209.txt (git can't deal with special characters)
  2021-01-06 21:47     ` Torsten Bögershausen
@ 2021-01-06 22:21       ` Daniel Troger
  2021-01-06 23:07         ` Randall S. Becker
  0 siblings, 1 reply; 14+ messages in thread
From: Daniel Troger @ 2021-01-06 22:21 UTC (permalink / raw)
  To: Torsten Bögershausen; +Cc: git

Hi, maybe this helps you reproduce. I think I should have committed before doing the second changes but I still got the error message and the two names for one folder:

me@iMac:/tmp$ mkdir git_bug
me@iMac:/tmp$ cd git_bug
me@iMac:/tmp/git_bug$ git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint: 	git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint: 	git branch -m <name>
Initialized empty Git repository in /private/tmp/git_bug/.git/
me@iMac:/tmp/git_bug$ ls -la
total 8
drwxr-xr-x   4 daniel  wheel   128 Jan  6 23:13 .
drwxrwxrwt  27 root    wheel   864 Jan  6 23:13 ..
drwxr-xr-x   9 daniel  wheel   288 Jan  6 23:12 .git
-rw-r--r--@  1 daniel  staff  1283 Jan  6 23:13 paulbrunngård-springyard.zip
me@iMac:/tmp/git_bug$ unzip paulbrunngård-springyard.zip 
Archive:  paulbrunngård-springyard.zip
   creating: paulbrunnga??rd-springyard/
  inflating: paulbrunnga??rd-springyard/.DS_Store  
   creating: __MACOSX/
   creating: __MACOSX/paulbrunnga??rd-springyard/
  inflating: __MACOSX/paulbrunnga??rd-springyard/._.DS_Store  
 extracting: paulbrunnga??rd-springyard/empty  
me@iMac:/tmp/git_bug$ rm -rf __MACOSX/ *.zip
me@iMac:/tmp/git_bug$ ls -la
total 0
drwxr-xr-x   4 daniel  wheel  128 Jan  6 23:15 .
drwxrwxrwt  27 root    wheel  864 Jan  6 23:13 ..
drwxr-xr-x   9 daniel  wheel  288 Jan  6 23:15 .git
drwxr-xr-x@  4 daniel  wheel  128 Jan  6 12:20 paulbrunngård-springyard
me@iMac:/tmp/git_bug$ cd paulbrunngård-springyard/
me@iMac:/tmp/git_bug/paulbrunngård-springyard$ nano empty 
me@iMac:/tmp/git_bug/paulbrunngård-springyard$ cat empty 
Initial content
me@iMac:/tmp/git_bug/paulbrunngård-springyard$ git add empty 
me@iMac:/tmp/git_bug/paulbrunngård-springyard$ nano empty 
me@iMac:/tmp/git_bug/paulbrunngård-springyard$ cat empty 
Initial content


Line I want to keep

Line I want gone
me@iMac:/tmp/git_bug/paulbrunngård-springyard$ git restore -p .
BUG: pathspec.c:495: error initializing pathspec_item
Cannot close git diff-index --cached --numstat --summary 4b825dc642cb6eb9a060e54bf8d69288fbee4904 -- :(,prefix:27)paulbrunngård-springyard/ () at /usr/local/Cellar/git/2.30.0/libexec/git-core/git-add--interactive line 183.
me@iMac:/tmp/git_bug/paulbrunngård-springyard$ cd ..
me@iMac:/tmp/git_bug$ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
	new file:   "paulbrunnga\314\212rd-springyard/empty"

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   "paulbrunnga\314\212rd-springyard/empty"

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	.DS_Store
	"paulbrunng\303\245rd-springyard/"

me@iMac:/tmp/git_bug$ 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-bugreport-2021-01-06-1209.txt (git can't deal with special characters)
  2021-01-06 16:49   ` Daniel Troger
@ 2021-01-06 21:47     ` Torsten Bögershausen
  2021-01-06 22:21       ` Daniel Troger
  0 siblings, 1 reply; 14+ messages in thread
From: Torsten Bögershausen @ 2021-01-06 21:47 UTC (permalink / raw)
  To: Daniel Troger; +Cc: git

On Wed, Jan 06, 2021 at 05:49:17PM +0100, Daniel Troger wrote:

(Please avoid top-posting in this list)
> Hi, thank you for investigating. Here's the output you asked for + proof the issue still persists on the latest version of git:
>

Thank's for testing the latest version.

Is there any way, that we can reproduce your problem ?

We don't have access to you repo (or do we ?)

Unzipping your zip on a Linux box shows these file:
./__MACOSX
./__MACOSX/paulbrunngård-springyard
./__MACOSX/paulbrunngård-springyard/._.DS_Store
./paulbrunngård-springyard
./paulbrunngård-springyard/.DS_Store
./paulbrunngård-springyard/empty

Is it possible to make a step-by-step receipe to get a dummy repo into
this state ?

> ```
>
> me@iMac:[redacted]/paulbrunngård-springyard/src$ git restore -p .
> BUG: pathspec.c:495: error initializing pathspec_item
> Cannot close git diff-index --cached --numstat --summary HEAD -- :(,prefix:44)[redacted]/paulbrunngård-springyard/src/ () at /usr/local/Cellar/git/2.30.0/libexec/git-core/git-add--interactive line 183.
> me@iMac:[redacted]/paulbrunngård-springyard/src$ git --version
> git version 2.30.0
> me@iMac:[redacted]/paulbrunngård-springyard/src$ git config -l | grep unicode
> core.precomposeunicode=true
> ```
>
> > 6 jan. 2021 kl. 15:21 skrev Torsten Bögershausen <tboegi@web.de>:
> >
> > On Wed, Jan 06, 2021 at 12:35:26PM +0100, Daniel Troger wrote:
> >> Thank you for filling out a Git bug report!
> >> Please answer the following questions to help us understand your issue.
> >>
> >> What did you do before the bug happened? (Steps to reproduce your issue)
> >> I ran `git restore -p .`
> >>
> >> What did you expect to happen? (Expected behavior)
> >> git restore to open in interactive mode and letting me select data to discard
> >>
> >> What happened instead? (Actual behavior)
> >> I got an error message:
> >> ```
> >> me@iMac:[redacted]/paulbrunngård-springyard/src$ git restore -p .
> >> BUG: pathspec.c:495: error initializing pathspec_item
> >> Cannot close git diff-index --cached --numstat --summary HEAD -- :(,prefix:44)[redacted]/paulbrunngård-springyard/src/ () at /usr/local/Cellar/git/2.29.2/libexec/git-core/git-add--interactive line 183.
> >> ```
> >>
> >> What's different between what you expected and what actually happened?
> >> The main problem is that the command didn't do anything. It basically printed an error message instead of changing a file in the way I wanted.
> >>
> >> Anything else you want to add:
> >> Yeah. So pretty obviously the problem is the "å" in the filename. The interesting thing is that the folder with the "å" in the filename seems to exist twice, with differently encoded "å"s. But their content IS AUTOMATICALLY PERFECTLY SYNCED. And the only tool which recognizes them as two different folders is git. ls in the terminal shows them as one, finder shows them as one, even "glob" in php shows them as one.
> >> This is what git seems to see them at (taken from git status):
> >>
> >> `modified:   "paulbrunnga\314\212rd-springyard/`
> >> And further down:
> >> ```
> >> Untracked files:
> >>  (use "git add <file>..." to include in what will be committed)
> >>    "paulbrunng\303\245rd-springyard/"
> >> ```
> >> Here is a zip containing the folder (emptied): https://arxius.io/f/7ec7e1c7
> >> I tried creating a new git repo, extracting the zip in it, going into the folder and running `git add empty` and could reproduce that git sees it as two different folders.
> >>
> >>
> >> Please review the rest of the bug report below.
> >> You can delete any lines you don't wish to share.
> >>
> >>
> >> [System Info]
> >> git version:
> >> git version 2.29.2
> >> cpu: x86_64
> >> no commit associated with this build
> >> sizeof-long: 8
> >> sizeof-size_t: 8
> >> shell-path: /bin/sh
> >> uname: Darwin 17.7.0 Darwin Kernel Version 17.7.0: Sun Jun  2 20:31:42 PDT 2019; root:xnu-4570.71.46~1/RELEASE_X86_64 x86_64
> >> compiler info: clang: 10.0.0 (clang-1000.11.45.5)
> >> libc info: no libc information available
> >> $SHELL (typically, interactive shell): /bin/bash
> >>
> >>
> >> [Enabled Hooks]
> >>
> >
> > This uses the decomposed form of "å":
> >> `modified:   "paulbrunnga\314\212rd-springyard/`
> > ...
> > And here is the precomposed form og the "å"
> >> Untracked files:
> >>  (use "git add <file>..." to include in what will be committed)
> >>    "paulbrunng\303\245rd-springyard/"
> >> ```
> >
> > Both are lowercase, right ?
> >
> > What does
> > git config -l | grep unicode
> > tell you ?
> >
> > I have
> > core.precomposeunicode=true
> >
> > and that what we need on a Mac (to handle precomposed and decomposed better)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-bugreport-2021-01-06-1209.txt (git can't deal with special characters)
  2021-01-06 14:21 ` Torsten Bögershausen
@ 2021-01-06 16:49   ` Daniel Troger
  2021-01-06 21:47     ` Torsten Bögershausen
  0 siblings, 1 reply; 14+ messages in thread
From: Daniel Troger @ 2021-01-06 16:49 UTC (permalink / raw)
  To: Torsten Bögershausen; +Cc: git

Hi, thank you for investigating. Here's the output you asked for + proof the issue still persists on the latest version of git:

```

me@iMac:[redacted]/paulbrunngård-springyard/src$ git restore -p .
BUG: pathspec.c:495: error initializing pathspec_item
Cannot close git diff-index --cached --numstat --summary HEAD -- :(,prefix:44)[redacted]/paulbrunngård-springyard/src/ () at /usr/local/Cellar/git/2.30.0/libexec/git-core/git-add--interactive line 183.
me@iMac:[redacted]/paulbrunngård-springyard/src$ git --version
git version 2.30.0
me@iMac:[redacted]/paulbrunngård-springyard/src$ git config -l | grep unicode
core.precomposeunicode=true
```

> 6 jan. 2021 kl. 15:21 skrev Torsten Bögershausen <tboegi@web.de>:
> 
> On Wed, Jan 06, 2021 at 12:35:26PM +0100, Daniel Troger wrote:
>> Thank you for filling out a Git bug report!
>> Please answer the following questions to help us understand your issue.
>> 
>> What did you do before the bug happened? (Steps to reproduce your issue)
>> I ran `git restore -p .`
>> 
>> What did you expect to happen? (Expected behavior)
>> git restore to open in interactive mode and letting me select data to discard
>> 
>> What happened instead? (Actual behavior)
>> I got an error message:
>> ```
>> me@iMac:[redacted]/paulbrunngård-springyard/src$ git restore -p .
>> BUG: pathspec.c:495: error initializing pathspec_item
>> Cannot close git diff-index --cached --numstat --summary HEAD -- :(,prefix:44)[redacted]/paulbrunngård-springyard/src/ () at /usr/local/Cellar/git/2.29.2/libexec/git-core/git-add--interactive line 183.
>> ```
>> 
>> What's different between what you expected and what actually happened?
>> The main problem is that the command didn't do anything. It basically printed an error message instead of changing a file in the way I wanted.
>> 
>> Anything else you want to add:
>> Yeah. So pretty obviously the problem is the "å" in the filename. The interesting thing is that the folder with the "å" in the filename seems to exist twice, with differently encoded "å"s. But their content IS AUTOMATICALLY PERFECTLY SYNCED. And the only tool which recognizes them as two different folders is git. ls in the terminal shows them as one, finder shows them as one, even "glob" in php shows them as one.
>> This is what git seems to see them at (taken from git status):
>> 
>> `modified:   "paulbrunnga\314\212rd-springyard/`
>> And further down:
>> ```
>> Untracked files:
>>  (use "git add <file>..." to include in what will be committed)
>>    "paulbrunng\303\245rd-springyard/"
>> ```
>> Here is a zip containing the folder (emptied): https://arxius.io/f/7ec7e1c7
>> I tried creating a new git repo, extracting the zip in it, going into the folder and running `git add empty` and could reproduce that git sees it as two different folders.
>> 
>> 
>> Please review the rest of the bug report below.
>> You can delete any lines you don't wish to share.
>> 
>> 
>> [System Info]
>> git version:
>> git version 2.29.2
>> cpu: x86_64
>> no commit associated with this build
>> sizeof-long: 8
>> sizeof-size_t: 8
>> shell-path: /bin/sh
>> uname: Darwin 17.7.0 Darwin Kernel Version 17.7.0: Sun Jun  2 20:31:42 PDT 2019; root:xnu-4570.71.46~1/RELEASE_X86_64 x86_64
>> compiler info: clang: 10.0.0 (clang-1000.11.45.5)
>> libc info: no libc information available
>> $SHELL (typically, interactive shell): /bin/bash
>> 
>> 
>> [Enabled Hooks]
>> 
> 
> This uses the decomposed form of "å":
>> `modified:   "paulbrunnga\314\212rd-springyard/`
> ...
> And here is the precomposed form og the "å"
>> Untracked files:
>>  (use "git add <file>..." to include in what will be committed)
>>    "paulbrunng\303\245rd-springyard/"
>> ```
> 
> Both are lowercase, right ?
> 
> What does
> git config -l | grep unicode
> tell you ?
> 
> I have
> core.precomposeunicode=true
> 
> and that what we need on a Mac (to handle precomposed and decomposed better)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: git-bugreport-2021-01-06-1209.txt (git can't deal with special characters)
  2021-01-06 11:35 Daniel Troger
@ 2021-01-06 14:21 ` Torsten Bögershausen
  2021-01-06 16:49   ` Daniel Troger
  0 siblings, 1 reply; 14+ messages in thread
From: Torsten Bögershausen @ 2021-01-06 14:21 UTC (permalink / raw)
  To: Daniel Troger; +Cc: git

On Wed, Jan 06, 2021 at 12:35:26PM +0100, Daniel Troger wrote:
> Thank you for filling out a Git bug report!
> Please answer the following questions to help us understand your issue.
>
> What did you do before the bug happened? (Steps to reproduce your issue)
> I ran `git restore -p .`
>
> What did you expect to happen? (Expected behavior)
> git restore to open in interactive mode and letting me select data to discard
>
> What happened instead? (Actual behavior)
> I got an error message:
> ```
> me@iMac:[redacted]/paulbrunngård-springyard/src$ git restore -p .
> BUG: pathspec.c:495: error initializing pathspec_item
> Cannot close git diff-index --cached --numstat --summary HEAD -- :(,prefix:44)[redacted]/paulbrunngård-springyard/src/ () at /usr/local/Cellar/git/2.29.2/libexec/git-core/git-add--interactive line 183.
> ```
>
> What's different between what you expected and what actually happened?
> The main problem is that the command didn't do anything. It basically printed an error message instead of changing a file in the way I wanted.
>
> Anything else you want to add:
> Yeah. So pretty obviously the problem is the "å" in the filename. The interesting thing is that the folder with the "å" in the filename seems to exist twice, with differently encoded "å"s. But their content IS AUTOMATICALLY PERFECTLY SYNCED. And the only tool which recognizes them as two different folders is git. ls in the terminal shows them as one, finder shows them as one, even "glob" in php shows them as one.
> This is what git seems to see them at (taken from git status):
>
> `modified:   "paulbrunnga\314\212rd-springyard/`
> And further down:
> ```
> Untracked files:
>   (use "git add <file>..." to include in what will be committed)
> 	"paulbrunng\303\245rd-springyard/"
> ```
> Here is a zip containing the folder (emptied): https://arxius.io/f/7ec7e1c7
> I tried creating a new git repo, extracting the zip in it, going into the folder and running `git add empty` and could reproduce that git sees it as two different folders.
>
>
> Please review the rest of the bug report below.
> You can delete any lines you don't wish to share.
>
>
> [System Info]
> git version:
> git version 2.29.2
> cpu: x86_64
> no commit associated with this build
> sizeof-long: 8
> sizeof-size_t: 8
> shell-path: /bin/sh
> uname: Darwin 17.7.0 Darwin Kernel Version 17.7.0: Sun Jun  2 20:31:42 PDT 2019; root:xnu-4570.71.46~1/RELEASE_X86_64 x86_64
> compiler info: clang: 10.0.0 (clang-1000.11.45.5)
> libc info: no libc information available
> $SHELL (typically, interactive shell): /bin/bash
>
>
> [Enabled Hooks]
>

This uses the decomposed form of "å":
> `modified:   "paulbrunnga\314\212rd-springyard/`
...
And here is the precomposed form og the "å"
> Untracked files:
>   (use "git add <file>..." to include in what will be committed)
> 	"paulbrunng\303\245rd-springyard/"
> ```

Both are lowercase, right ?

What does
git config -l | grep unicode
tell you ?

I have
core.precomposeunicode=true

and that what we need on a Mac (to handle precomposed and decomposed better)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* git-bugreport-2021-01-06-1209.txt (git can't deal with special characters)
@ 2021-01-06 11:35 Daniel Troger
  2021-01-06 14:21 ` Torsten Bögershausen
  0 siblings, 1 reply; 14+ messages in thread
From: Daniel Troger @ 2021-01-06 11:35 UTC (permalink / raw)
  To: git

Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)
I ran `git restore -p .`

What did you expect to happen? (Expected behavior)
git restore to open in interactive mode and letting me select data to discard

What happened instead? (Actual behavior)
I got an error message:
```
me@iMac:[redacted]/paulbrunngård-springyard/src$ git restore -p .
BUG: pathspec.c:495: error initializing pathspec_item
Cannot close git diff-index --cached --numstat --summary HEAD -- :(,prefix:44)[redacted]/paulbrunngård-springyard/src/ () at /usr/local/Cellar/git/2.29.2/libexec/git-core/git-add--interactive line 183.
```

What's different between what you expected and what actually happened?
The main problem is that the command didn't do anything. It basically printed an error message instead of changing a file in the way I wanted.

Anything else you want to add:
Yeah. So pretty obviously the problem is the "å" in the filename. The interesting thing is that the folder with the "å" in the filename seems to exist twice, with differently encoded "å"s. But their content IS AUTOMATICALLY PERFECTLY SYNCED. And the only tool which recognizes them as two different folders is git. ls in the terminal shows them as one, finder shows them as one, even "glob" in php shows them as one.
This is what git seems to see them at (taken from git status):

`modified:   "paulbrunnga\314\212rd-springyard/`
And further down:
```
Untracked files:
  (use "git add <file>..." to include in what will be committed)
	"paulbrunng\303\245rd-springyard/"
```
Here is a zip containing the folder (emptied): https://arxius.io/f/7ec7e1c7
I tried creating a new git repo, extracting the zip in it, going into the folder and running `git add empty` and could reproduce that git sees it as two different folders.


Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.29.2
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Darwin 17.7.0 Darwin Kernel Version 17.7.0: Sun Jun  2 20:31:42 PDT 2019; root:xnu-4570.71.46~1/RELEASE_X86_64 x86_64
compiler info: clang: 10.0.0 (clang-1000.11.45.5)
libc info: no libc information available
$SHELL (typically, interactive shell): /bin/bash


[Enabled Hooks]


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-01-16 17:35 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-08 19:56 git-bugreport-2021-01-06-1209.txt (git can't deal with special characters) Daniel Troger
2021-01-09 17:23 ` Torsten Bögershausen
2021-01-13 14:57   ` Daniel Troger
2021-01-16 17:24     ` Torsten Bögershausen
  -- strict thread matches above, loose matches on Subject: below --
2021-01-06 11:35 Daniel Troger
2021-01-06 14:21 ` Torsten Bögershausen
2021-01-06 16:49   ` Daniel Troger
2021-01-06 21:47     ` Torsten Bögershausen
2021-01-06 22:21       ` Daniel Troger
2021-01-06 23:07         ` Randall S. Becker
2021-01-07 14:34           ` Philippe Blain
2021-01-07 15:49             ` Torsten Bögershausen
2021-01-07 16:21               ` Philippe Blain
2021-01-08 19:07                 ` Torsten Bögershausen

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for the project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git