microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
161.82k stars 28.45k forks source link

Git add of file with unicode name fails in Git panel #41246

Open neoeinstein opened 6 years ago

neoeinstein commented 6 years ago
Extension Author (truncated) Version
vscode-base64 ada 0.0.1
vscode-database baj 1.2.0
toml be5 0.0.3
vscode-markdownlint Dav 0.12.0
createuniqueid don 0.0.3
githistory don 0.2.3
EditorConfig Edi 0.11.1
git-project-manager fel 1.4.0
mdmath goe 2.1.0
vscode-wordcount-cjk hol 1.0.0
Ionide-FAKE Ion 1.2.3
Ionide-fsharp Ion 3.15.7
Ionide-Paket Ion 1.8.1
copy-markdown-as-html jer 1.0.0
golang-tdd joa 0.0.9
Go luk 0.6.71
reflow-markdown mar 1.3.0
azure-account ms- 0.2.2
csharp ms- 1.13.1
vscode-docker Pet 0.0.23
vscode-icons rob 7.19.0
go-test-outline Rom 0.1.4
rust rus 0.3.2
vscode-autohotkey sle 0.2.1
vscode-helm tec 0.3.0
vscode-lldb vad 0.7.3
vim vsc 0.10.8
debug web 0.21.2

Steps to Reproduce:

  1. Initialize a git repository and open the folder in VSCode.
  2. Create a new file named defaŭlto.html.
  3. From the VSCode Git panel, use the "+" icon to stage the new file.
  4. Error reported: fatal: pathspec 'c:\…\defaulto.html' did not match any files

Git log reports that it ran the following command: "git add -A -- c:\…\defaŭlto.html"

Running the same command from the git command line in Powershell works without a problem, but also fails from the normal Windows command prompt. Reviewing StackOverflow and other locations, it appears that this is a limitation of the Windows command prompt, but I thought I would document it here since it has a knock-on effect for the Git panel.

Reproduces without extensions: Yes

aleksijohansson commented 6 years ago

Had a similar issue in #47677 which was closed as duplicate. Looking forward to the fix to this one.

prabhu43 commented 5 years ago

@neoeinstein This is working in version 1.28.2.

joaomoreno commented 5 years ago

@neoeinstein Do you confirm this?

neoeinstein commented 5 years ago

I can confirm that this appears to be working now with 1.28.2. Thanks!

MDKi commented 5 years ago

I can confirm you can add files with unicode names, but:

Had a similar issue in #47677 which was closed as duplicate. Looking forward to the fix to this one.

When the unicode characters are in folder names, it still fails.

Just in case it's relevant, I'm on 1.34.0, macOS 10.14.5.

pepelsbey commented 4 years ago

This is still happening for me in 1.46.1 on macOS 10.15.5

Git: fatal: /Users/pepelsbey/Projects/Пепелсбей.net/Блог/playground/28/.editorconfig: '/Users/pepelsbey/Projects/Пепелсбей.net/Блог/playground/28/.editorconfig' is outside repository

As you can see I have Cyrillic folder names.

joaomoreno commented 4 years ago

@pepelsbey You have a different issue. Please update to Git 2.27 and it will be fixed.

pepelsbey commented 4 years ago

@joaomoreno I have Git 2.27 installed on my system. I believe that’s the one VS Code uses.

$ git --version
git version 2.27.0

But I still have this problem.

pepelsbey commented 4 years ago

I managed to reproduce it with the minimal setup:

  1. mkdir й && cd й
  2. git init
  3. touch file.md
  4. Open the folder in VS Code (1.46.1)
  5. Go to Source Control panel
  6. Try to stage file.md

It works fine if the folder is named q instead of й.

image image
joaomoreno commented 4 years ago

What exact keyboard combination do you press to write й?

pepelsbey commented 4 years ago

It’s a single letter on the same key as q.

й
CYRILLIC SMALL LETTER SHORT I
Unicode: U+0439, UTF-8: D0 B9

image

BTW, sometimes macOS (for some reason) uses two symbols to reproduce it: и plus combining top character (not sure which one).

utotch commented 3 years ago

I have the same problem with Japanese path name and git version 2.29.2.

pepelsbey commented 3 years ago

It works for me now as expected in 1.51.1 on macOS 11.0.1 with git 2.29.2

I managed to reproduce it with the minimal setup:

1. `mkdir й && cd й`
2. `git init`
3. `touch file.md`
4. Open the folder in VS Code (1.46.1)
5. Go to Source Control panel
6. Try to stage file.md

It works fine if the folder is named q instead of й.

cosmicbeamer commented 3 years ago

Just tested and it works:

EDIT 1: Also works on M1

EDIT 2: Problem is not completely solved. If the folder name starts with a capital letter, the error is still present :( Folder was created via Finder

EDIT 3: Did more tests… Now I can't reproduce the problem as described in EDIT2… Really strange ;) Folders were created via mkdir

EDIT 4: Now I know what is going on. If the folder is created via shell with mkdir it works. If the folder is created or renamed via Finder it fails.

MDKi commented 3 years ago

@pepelsbey

BTW, sometimes macOS (for some reason) uses two symbols to reproduce it: и plus combining top character (not sure which one).

Look up dead keys. After YEARS suffering with them I could finally disable them on Windows. (Using Microsoft Keyboard Layout Creator.)

Sorry if my reply is off topic. 😅

pepelsbey commented 2 years ago

Unfortunately it’s still broken in 1.59.1. Here’s another way to reproduce:

  1. Finder: File > New Folder > й
  2. cd й enter the folder
  3. git init init repository
  4. touch file.md create a file
  5. code . open the folder in VS Code
  6. Go to Source Control panel

And you’ll see that repository doesn’t exist:

image

But it works fine with и letter for the folder name:

image
pepelsbey commented 2 years ago

Now I know what is going on. If the folder is created via shell with mkdir it works. If the folder is created or renamed via Finder it fails.

Unfortunately I cannot reproduce that.

MDKi commented 2 years ago

Unfortunately it’s still broken in 1.59.1. Here’s another way to reproduce:

  1. Finder: File > New Folder > й
  2. cd й enter the folder
  3. git init init repository
  4. touch file.md create a file
  5. code . open the folder in VS Code
  6. Go to Source Control panel

And you’ll see that repository doesn’t exist:

image

But it works fine with и letter for the folder name:

image

If I follow those steps, I see the repository as not initialized for a few seconds, then it shows up normally. But it still won't stage any file.

Screen Shot 2021-08-30 at 17 51 28

This is the output from the git log:

Looking for git in: /usr/local/bin/git
Using git 2.31.1 from /usr/local/bin/git
> git rev-parse --git-dir
Open repository: /Users/gabriel/Downloads/test/ú
> git status -z -u
> git symbolic-ref --short HEAD
> git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/main refs/remotes/main
> git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname)
> git remote --verbose
> git config --local branch.main.github-pr-owner-number
> git config --get commit.template
> git config --local branch.main.github-pr-owner-number
> git check-ignore -v -z --stdin
> git config --global user.email
> git config --global user.name
> git status -z -u
> git symbolic-ref --short HEAD
> git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/main refs/remotes/main
> git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname)
> git remote --verbose
> git config --get commit.template
git.stage 1
git.stage.scmResources 1
> git add -A -- /Users/gabriel/Downloads/test/ú/file.md
fatal: /Users/gabriel/Downloads/test/ú/file.md: '/Users/gabriel/Downloads/test/ú/file.md' is outside repository at '/Users/gabriel/Downloads/test/ú'
MDKi commented 2 years ago

Now I know what is going on. If the folder is created via shell with mkdir it works. If the folder is created or renamed via Finder it fails.

Unfortunately I cannot reproduce that.

I could and can confirm. Using mkdir it works as it should. As soon as I rename it on Finder, it breaks again. It doesn't seem to be a problem with git, as I can git add file.md and git rm --cached file.md from a terminal without problem, and even vscode reflects changes correctly.

pepelsbey commented 2 years ago

It doesn't seem to be a problem with git

Yes, that’s the point. When GUI fails to stage files I open VS Code’s terminal to do it via CLI using the same git binary.

yevvonlim commented 2 years ago

I have the same issue now. Have anyone solved this?

Lionel-cl commented 2 years ago

I have exactly the same issue with éèà letters, in French. But this is come from git. not from Vscode. try this in terminal : git add -A -- /Users/me/Documents/Activités/index.html any solution? thank you

lamusique commented 2 years ago

Even though this issue looks similar to #135257 #134696, why hasn't it been resolved for over four years since 2018?

arslc commented 1 year ago

Hello everyone, idk why this issue is not fixed, but @cosmicbeamer - THANK YOU!

System:


Problem:

Solution:

  1. Rename "Программа" to "Программа2"
  2. mkdir Программа
  3. Transfer all files from "Программа2" dir to "Программа" dir (created by mkdir)
  4. Stage changes, commit, push - and IT WORKS!

P.S. Maybe u should restart vs code if it's not working

P.S.S. It works for me, but it may not work for you, just try)

giorgionicoletti commented 10 months ago

Same issue. This has been going on since 2018, how is it possible that there is no working solution?

johannes-langer commented 6 months ago

This is still relevant as of 02/2024. Would there be a way to look at/change which commands are run in the background when the Git GUI is used?

lszomoru commented 6 months ago

@johannes-langer, could you please share the steps that you have followed to reproduce this? I have spent some time trying to create folders/files using Finder, VS code, terminal and I am unable to reproduce the issue using the latest version of VS Code Insiders and git version 2.42.0.

MDKi commented 5 months ago

@johannes-langer, could you please share the steps that you have followed to reproduce this? I have spent some time trying to create folders/files using Finder, VS code, terminal and I am unable to reproduce the issue using the latest version of VS Code Insiders and git version 2.42.0.

I can still reproduce the issue as mentioned on https://github.com/microsoft/vscode/issues/41246#issuecomment-908688963

gabriel@Gabriels-MacBook-Pro й % sw_vers ProductName: macOS ProductVersion: 12.6.7 BuildVersion: 21G651 gabriel@Gabriels-MacBook-Pro й % git version git version 2.44.0 gabriel@Gabriels-MacBook-Pro й % code-insiders --version 1.88.0-insider cc1f5e3acfad98ed519befc1ebfd199777d135f4 x64

lszomoru commented 5 months ago

@MDKi, could you please share a recording (https://gifcap.dev) with the repro steps? Thanks!