At the moment, DVC make changes to the .gitignore after commands like dvc add
. There are cases, like mine, where it's not needed as .gitignore already exclude whole directory where data is kept.
Add a configuration that allow to suppress dvc changes to .gitignore.
@piojanu I guess what we should do is check whether or not the data is already ignored by git and if it is then just not add it to yet another gitignore. Does that make sense for your scenario?
Hmm. You would have to check if e.g. whole directory, that the file is in, isn't ignored already. Then it would do fine.
@piojanu Sure. There is actually a git check-ignore
command, which we could utilize, unless there is a more straightforward way in GitPython.
@piojanu Ok, there is actually a repo.git.check_ignore()
supported already. So basically all we'll have to do is to add a check for it to Git.ignore()
in https://github.com/iterative/dvc/blob/master/dvc/scm/git.py#L76 . Would you like to submit a PR for it? :slightly_smiling_face:
I'd love too, but for now I have very little time to sit down to it.
@piojanu No worries :) We'll try to get to it when we have time then. Thanks for the feedback! :slightly_smiling_face:
Hey @efiop and @piojanu. I can work on this after work tonight. Do you mind if I take this issue?
Hi @J0 ! Sure! Thanks a lot for looking into it! Let us know if you need any help and/or have any questions. :slightly_smiling_face:
Anyone working on it ? or I can pick this up with some help
@veera83372 Not sure if @J0 is still working on this. Let's see if he replies.
@efiop I am still working on this issue. Sorry for the long delay — just opened a PR
Is this still being worked on?
@J0 Are you still working on this?
@Aljo-Rovco I doubt. The PR (empty?) was closed a while ago. Feel free to pick it up and contribute and let us know if you'd need any help from us.
@shcheklein was planning to give 1 day for @J0 to reply and then give this a go, but ok :)
@Aljo-Rovco Looks like @J0 is not responding, so indeed, please feel free to take this one. Thanks a lot for looking into it! 🙂
@Aljo-Rovco Are you working on this?
Hey sorry, was swamped. Not sure how well I'm suited to contribute, but I can try. Would it just be a check here: https://github.com/iterative/dvc/blob/master/dvc/scm/git/__init__.py#L137 ?
@Aljo-Rovco No worries. That would be the place to check, yes :slightly_smiling_face:
@efiop created a PR
@efiop I'd like to ask will this change affect my case? I prefer to write root .gitignore like this:
data/**
!data/*.dvc
@RomanSteinberg I think so, yes. :slightly_smiling_face: The new version is already out on pypi and conda, so give it a try and let us know if it works for you or not.
It works fine in 0.82.9. Thank you!