libgit2 / libgit2/libgit2sharp

Cannot stage a folder which contains a file with name ".git"

Open
#1,699 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Description

Reproduction steps
  1. Use LibGit2Sharp to work on a local git repository
  2. Create some random sub folders in that local repository folder
  3. Create in some of these subfolders a file with the name ".git"
  4. Try to stage all changes
Expected behavior

Like with e.g. Git for Windows
https://git-scm.com/download/win
The file gets just added to the repro without any exception

At least I would expect a better error description

Actual behavior

The LibGit2Sharp stage process crashes with an exception.
The exception contains the message "Invalid path"
It took a while till I figured out why this actually happens.

Version of LibGit2Sharp (release number or SHA1)

Nuget version of LibGit2Sharp: 0.26.0 (Current latest)
Nuget version of LibGit2Sharp.NativeBinaries: 2.0.267 (Newer version available but not compatible to newest LibGit2Sharp)

Operating system(s) tested; .NET runtime tested

Windows 10 Version 1903 - Build 18362.239

Project settings

The project in which I use the LibGit2Sharp is build with Visual Studio 2019.
The project uses the .Net Framework 4.7.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce staging on Windows 10 with LibGit2Sharp 0.26.0 and LibGit2Sharp.NativeBinaries 2.0.267 using a repository containing a file named ".git" in a subfolder. Compare the behavior with Git for Windows, then trace the staging path that produces the "Invalid path" exception. Done means the file can be staged without an exception, or the error clearly identifies the cause.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.