jupyterlab/jupyterlab-git

Branch name conflicts with existing directory name

Paul2708 opened this issue · 1 comments

Description

If there exists a directory with the same name as a branch, switching to this branch fails.
The following error message is shown:

image

Failed to switch branch: fatal: ambiguous argument 'b': both revision and filename Use '--' to separate paths from revisions, like this: 'git [...] -- [...]'

Reproduce

  1. Initialize a new repository and create an initial commit (e.g., creating a README file).
  2. Create a new branch "test". Now, switching branches works as expected.
  3. Switch into branch "main" and create a new directory called "test".
  4. Now, switching back to the branch "test" results in the error above.

Expected behavior

Due to the error, the branch could not be switched.
Thus, the expected behavior is that switching branches works even if there is a directory with the same name.

Context

  • Python package version: 0.50.0
  • Extension version: @jupyterlab/git v0.50.0 enabled OK (python, jupyterlab-git)
  • Git version: 2.42.0
  • Operating System and its version: Ubuntu 20.04 (WSL)
Command Line Output
[D 2024-02-28 20:40:06.211 ServerApp.jupyterlab_git] Execute ['git', 'diff', 'main', 'test', '--name-only', '-z'] in /home/paul/cammp/del-me-git-extension-test/myrepo.
[D 2024-02-28 20:40:06.216 ServerApp.jupyterlab_git] Code: 128
    Output:
    Error: fatal: ambiguous argument 'test': both revision and filename
    Use '--' to separate paths from revisions, like this:
    'git  [...] -- [...]'

[E 2024-02-28 20:40:06.217 ServerApp] {
"Host": "localhost:8888",
"Accept": "/",
"Referer": "http://localhost:8888/lab/tree/myrepo/Untitled.ipynb",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 OPR/107.0.0.0"
}
[E 2024-02-28 20:40:06.217 ServerApp] 500 POST /git/myrepo/changed_files?1709149206166 (7db4901c31a141f884dfee37ae6f7412@127.0.0.1) 48.59ms referer=http://localhost:8888/lab/tree/myrepo/Untitled.ipynb

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉