Skip to content

.gitignore not in root folder is ignored #764

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

Merged
merged 1 commit into from
Jul 12, 2015
Merged

.gitignore not in root folder is ignored #764

merged 1 commit into from
Jul 12, 2015

Conversation

nulltoken
Copy link
Member

If you create a folder and place .gitignore file there:

D:\repo\Reports\Acl_report
» type .gitignore
\fixes
Fixes.zip
DeviceStatistic.csv
PolicyStatistic.csv

The files mentioned in that .gitignore file would be ignored by git, but LibGti2Sharp would list them as untracked. That makes automation that uses LibGit2Sharp buggy - before push it tests if index is dirty. LibGit2 says it is, git says it is not.

PS Possible it is a limitation of lib2git - I don't know. If that is the case - please repost this bug or advice where do lib2git tracks bugs.

@nulltoken
Copy link
Member

@FallenGameR Thanks for this report!

@arrbee How do you feel about this?

@arrbee
Copy link
Member

arrbee commented Jun 13, 2014

This sounds like it could be one of the bugs fixed in libgit2/libgit2#2262 libgit2/libgit2#2279. @FallenGameR what version of libgit2sharp are you using? Let's track that back to libgit2 and see if you're using a version that has the ignore fixes.

This also be complicated by using \fixes with a backslash. Do you get the expected behavior if you use /fixes instead?

@FallenGameR
Copy link
Author

To @arrbee

what version of libgit2sharp are you using?

InternalName : git2-11f8336.dll
FileVersion : 0.19.0
InternalName : LibGit2Sharp.dll
FileVersion : 0.14.1

Do you get the expected behavior if you use /fixes instead?

Yes. But in git for windows is works both ways.

@FallenGameR
Copy link
Author

Was this issue fixed?

It looks like we just hit this problem again:
git2-091165c.dll - FileVersion: 0.21.0
LibGit2Sharp.dll - FileVersion: 0.18.1

@nulltoken
Copy link
Member

I've added a test commit to this issue.

FWIW the test passes on my Win box and Travis seems happy with it as well.

Could you please ensure that I've correctly expressed your constraints?

@FallenGameR
Copy link
Author

How do we get the win dll with the fix for the test?
The Travis CI link I see shows osx and linux builds.

@nulltoken
Copy link
Member

How do we get the win dll with the fix for the test?

I've ran the test using the dll embedded in the Lib/ folder (see https://github.com/libgit2/libgit2sharp/tree/vNext/Lib/NativeBinaries)

@jamill
Copy link
Member

jamill commented Nov 3, 2014

How do we get the win dll with the fix for the test?

Which DLL are you looking for? For the LibGit2Sharp DLL, can you clone / fetch the repository, check out the branch with the fix (ntk/ignore), and build it?

@FallenGameR
Copy link
Author

check out the branch with the fix (ntk/ignore), and build it?

Did it. Thanks! We are testing the fix. Will respond if that change fixed it.

@FallenGameR
Copy link
Author

The fix didn't work for us :(

We have repro with this repository setup:

  1. .gitignore is placed here:
    private\Services\Hardware\services\CpuPerf\sys\cpuperf.gitignore

  2. .gitignore content is:
    SmtCounters.h
    SmtCounters.rc
    SmtCounters_counters.h

  3. A new file is created here:
    private\Services\Hardware\services\CpuPerf\sys\cpuperf\SmtCounters.h

Git.exe thinks index is clean, lib2git considers it dirty.

@jamill
Copy link
Member

jamill commented Nov 7, 2014

@FallenGameR - that is unfortunate. Would you be able to repro this in a failing test by any chance? or provide a specific repro setup that exhibits this issue? This might make it easier / quicker for someone to investigate the issue.

Thanks!

@nulltoken
Copy link
Member

@FallenGameR Hey! Is this still an issue for you or has it been fixed meanwhile?

@FallenGameR
Copy link
Author

No idea. We are switching to native git, so this problem is not pressing anymore.

@FallenGameR FallenGameR closed this Jun 5, 2015
@nulltoken nulltoken reopened this Jun 11, 2015
string path = InitNewRepository();
using (var repo = new Repository(path))
{
Touch(repo.Info.WorkingDirectory, ".gitignore", string.Format("{0}fixes{1}Fixes.zip{1}",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading this once again, I now realized that the provided test doesn't reflect was was intended.

Former self, you're an idiot. The .gitignoreshould be located in a nested folder. Not at the root.

@nulltoken
Copy link
Member

This PR has been updated. I believe this is now correctly reproducing the test case describe in #764 (comment)

@nulltoken nulltoken added this to the v0.22 milestone Jul 12, 2015
nulltoken added a commit that referenced this pull request Jul 12, 2015
.gitignore not in root folder is ignored
@nulltoken nulltoken merged commit b59c8a4 into vNext Jul 12, 2015
@nulltoken nulltoken deleted the ntk/ignore branch July 12, 2015 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants