-
Notifications
You must be signed in to change notification settings - Fork 1.2k
dvc ignore "!" syntax different behavior from git #5046
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
Comments
It's a good question but I tried the same in .gitignore and |
Yes you are right about the output of check-ignore but still I think there is a bug.
Then
but |
Yes, in that case DVC behaves different to Git by design (I think cc @efiop). It gives the error do that the user knows what's going and can address the situation if needed. What is the problem you are having, or what are you trying to achieve? |
Looks like a bug to me. We had a discussion on #4103 which was fixed by @karajan1001. It might be a mistake on DVC's part, and I wonder If it could be fixed by something similar to following (@karajan1001, please correct me if I am wrong): diff --git a/dvc/ignore.py b/dvc/ignore.py
index 301e6669..49621fdd 100644
--- a/dvc/ignore.py
+++ b/dvc/ignore.py
@@ -129,7 +129,10 @@ class DvcIgnorePatterns(DvcIgnore):
result.append(pattern.file_info)
else:
if regex.match(path):
- result.append(pattern.file_info)
+ if ignore[1] is False: # similarly for `is_dir`
+ result = []
+ else:
+ result.append(pattern.file_info)
return result |
But it shouldn't give an error, Git just added the file. My final goal is to ignore everything except of certain extensions |
@skshetry Seems that because of this Here I add two prints into
Maybe we should rename |
The problem is here. Line 533 in a7d6651
|
@karajan1001, thanks. So, we just have to change it to use For other internal functions, for example, I think |
From:
https://dvc.org/doc/command-reference/check-ignore
Why file2 is ignored?
Correct me if I'm worng but in git file2 shouldn't be ignored.
I am encountering this issue as a result of trying to ignore all files except certain extensions.
This works with git but not in dvc
There is anther way to do it in dvc?
The text was updated successfully, but these errors were encountered: