libgit2 / libgit2/libgit2sharp
.gitignore exclusions not being honoring correctly
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 3.5k
- Forks
- 925
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I am having an issue with inconsistent behavior when trying to exclude folders using a .gitignore. This issue is related to: https://github.com/git-tfs/git-tfs/issues/1047
Given the following repository directory:
/Main/.gitignore
/Main/Foo/test.txt
/Main/Foo/packages/test.txt
/Main/FooBar/test.txt
/Main/FooBar/packages/test.txt
And the following .gitignore file:
**/packages/*
!Foo/
!Foo/**
When I running the following code:
using (var repo = new Repository(@"C:\Git\Project\Main"))
{
repo.RetrieveStatus().Untracked.Dump();
}
Then I get to following results:
.gitignore
Foo\test.txt
FooBar\test.txt
When I run git status -u
Then I get to following results:
.gitignore
Foo/packages/test.txt
Foo/test.txt
FooBar/test.txt
I have also tried populating the ignore rules manually using AddTemporaryRules with the same results.
Thanks!
Christopher Haws
git version 2.10.2.windows.1
LibGit2Sharp version 0.23.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the report with Repository.RetrieveStatus and the shown nested .gitignore rules, then compare its Untracked results with git status -u. Also check the AddTemporaryRules path, and consider the issue done when negated directory rules produce the same included files as Git.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, git
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100