-
Notifications
You must be signed in to change notification settings - Fork 534
Adds support for .gitignore at repository root #420
Conversation
.gitignore
Outdated
@@ -1 +1,4 @@ | |||
coverage.out | |||
vendor/ | |||
.idea/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid adding content related to your choice of tools and editors to the project.
I suggest using a global $HOME/.gitignore file as an alternative.
git config --global core.excludesfile $HOME/.gitignore
Codecov Report
@@ Coverage Diff @@
## master #420 +/- ##
==========================================
- Coverage 77.8% 77.18% -0.62%
==========================================
Files 124 124
Lines 9019 9020 +1
==========================================
- Hits 7017 6962 -55
- Misses 1229 1300 +71
+ Partials 773 758 -15
Continue to review full report at Codecov.
|
@alcortesm done, changes to .gitignore removed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the filesystem abstraction is not the best place for Implementing the .gitignore
.
The right place IMHO is the Worktree
, because in git you have some operations such as git add --force
where the .gitignore
is ignored. So you need to be aware of the ignored files at the Worktree level.
@mcuadros The limitation has been listed in the original PR message, so it is a known limitation. I would generally agree with you for the change to be complete, but it would be much more involved and I would rather suggest doing it in a second iteration. I would not be able to offer a PR now for a change as suggested for the reasons of time constraints. |
@osklyar what I am asking is for move this to Worktree, not about implement git add force. Otherwise we will need to redo this PR as soon as we need the force, or any other similar feature. |
@mcuadros Ok, fair enough. If it is more or less a move of the code I will investigate and try to provide the corresponding change. |
Ok, I now know how to introduce this change in the Worktree directly, however, I have found out that the third-party gitignore pattern matcher that I've been using the change is incorrect on some patterns. Therefore, I will close this PR, work on a change to have a clean pattern matcher in the Worktree and then submit a new one. |
This PR adds basic support for
.gitignore
files. The code usesmygithub.libinneed.workers.dev/monochromegane/go-gitignore
, which, however, could be easily ported into a local package to avoid an additional external dependency.The PR covers 99% of the normal
.gitignore
usage, however, the following limitations as compared to the standard git client exist:.gitignore
files at the root of the repository are considered, files located deeper in the tree structure are not taken into account.gitignore
will be considered not present on the file system, so if forcefully committed, they may be shown as a change (has not been investigated).The effect of the change is easily seen in the following example using the
go-git
based client from github.com/silvertern/geat (WIP):Older state, without the PR:
With the PR:
Addresses #307, #340