pub
pub copied to clipboard
.gitignore validator triggers even when I have a different .pubignore in mono_repos
Environment
pub versionorflutter pub version: 2.15.0-233.0.dev
Problem
I was trying to migrate the test package to use a .pubignore file to work around the issue where it has a required file that is covered by a .gitignore, https://github.com/dart-lang/test/pull/1623/commits/5c55cf5f2524a11f60292a2bdce37d2b12386381.
When I run pub lish --dry-run with that file I still got the validator warning about the .gitignore lines:
Package validation found the following potential issues:
* 1 checked in file is ignored by a `.gitignore`.
Previous versions of Pub would include those in the published package.
Consider adjusting your `.gitignore` files to not ignore those files, and if you do not wish to
publish these files use `.pubignore`. See also dart.dev/go/pubignore
Files that are checked in while gitignored:
lib/src/runner/browser/static/host.dart.js
Expected behavior
I expected to not get a validator warning (it should use the .pubignore not the .gitignore).
So I didn't have confidence that it was actually working and just removed the lines from the .gitignore.
Same problem here, even if file is in pubignore we still have the warning
We have a similar issue. We have added two submodules to our repo, and even though we have added the paths to the submodules to the .pubignore file, we are still getting a warning similar to the one mentioned in the first post.
Sorry for never returning to this issue.
I can still reproduce the reported behavior.
It seems to me that lib/src/runner/browser/static/host.dart.js indeed is matched by the .gitignore file, and is also checked in. Is it intended to be part of the publication? In that case I would add an exception to the .gitignore file:
...
*.dart.js
!pkgs/test/lib/src/runner/browser/static/host.dart.js # <- this should not be gitignored
...
Then I think you can remove the .pubignore file.
I think this is working as intended
@jakemac53 can you confirm?
It does indeed work to explicitly allow the checked in files in the .gitignore.
However reading back over the original issue, it sounds like the problem is that the .gitignore is read even when a .pubignore is present, which is not working as documented?
Yeah - we should probably not warn about about "checked-in but gitignored" files if they are anyway covered by a pubignore...