Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
neoeinstein opened this issue Jan 7, 2018 · 29 comments
Open

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

neoeinstein opened this issue Jan 7, 2018 · 29 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug git GIT issues help wanted Issues identified as good community contribution opportunities
Milestone

Comments

@neoeinstein
Copy link

  • VSCode Version: Code 1.19.1 (0759f77, 2017-12-19T09:46:02.926Z)
  • OS Version: Windows_NT ia32 10.0.16299
  • Extensions:
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

@vscodebot vscodebot bot added the git GIT issues label Jan 7, 2018
@joaomoreno joaomoreno added this to the Backlog milestone Jan 8, 2018
@joaomoreno joaomoreno added the bug Issue identified by VS Code Team member as probable bug label Jan 8, 2018
@aleksijohansson
Copy link

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

@joaomoreno joaomoreno added the help wanted Issues identified as good community contribution opportunities label Sep 18, 2018
@prabhu43
Copy link

@neoeinstein This is working in version 1.28.2.

@joaomoreno
Copy link
Member

@neoeinstein Do you confirm this?

@neoeinstein
Copy link
Author

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

@MDKi
Copy link

MDKi commented May 22, 2019

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
Copy link

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
Copy link
Member

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

@pepelsbey
Copy link

@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
Copy link

pepelsbey commented Jul 7, 2020

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
Copy link
Member

What exact keyboard combination do you press to write й?

@pepelsbey
Copy link

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
Copy link

utotch commented Nov 27, 2020

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

@pepelsbey
Copy link

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
Copy link

cosmicbeamer commented Dec 11, 2020

Just tested and it works:

  • git version 2.29.2
  • vscode 1.51.1, e5a624b, x64
  • macOS 10.15.7

EDIT 1:
Also works on M1

  • git version 2.29.2, arm64
  • Version: 1.53.0-exploration, d530b3b, arm64
  • macOS 11.0.1

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.

@joaomoreno joaomoreno assigned eamodio and unassigned joaomoreno Dec 11, 2020
@MDKi
Copy link

MDKi commented Dec 12, 2020

@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
Copy link

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
Copy link

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
Copy link

MDKi commented Aug 30, 2021

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
Copy link

MDKi commented Aug 30, 2021

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
Copy link

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.

@lszomoru lszomoru assigned lszomoru and unassigned eamodio Oct 4, 2021
@three0-s
Copy link

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

@Lionel-cl
Copy link

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
Copy link

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

@arslc
Copy link

arslc commented Mar 14, 2023

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

System:

  • Mac OS 12.5.1
  • VS Code 1.76.1
  • git version 2.37.1 (Apple Git-137.1)

Problem:

  • I have directory "Программа" (created by finder) with my code files, and I get fatal error (can't stage changes and push to repo) |

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
Copy link

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

@johannes-langer
Copy link

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 lszomoru modified the milestones: Backlog, On Deck Feb 13, 2024
@lszomoru
Copy link
Member

@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
Copy link

MDKi commented Mar 7, 2024

@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 #41246 (comment)

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
cc1f5e3
x64

@lszomoru
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug git GIT issues help wanted Issues identified as good community contribution opportunities
Projects
None yet
Development

No branches or pull requests