]> git.madduck.net Git - etc/vim.git/commit

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Apply .gitignore correctly in every source entry (#3336)
authorAntonio Ossa-Guerra <aaossa@uc.cl>
Sat, 5 Nov 2022 05:09:59 +0000 (02:09 -0300)
committerGitHub <noreply@github.com>
Sat, 5 Nov 2022 05:09:59 +0000 (22:09 -0700)
commit0e9d29ab73d608a79028e22a713ee717b5dcca96
treede214dde36a0c9301a57108049c09c48ee218b9a
parent2704dc796b49b4c5d348c92ba14ef1cfd908e7f1
Apply .gitignore correctly in every source entry (#3336)

When passing multiple src directories, the root gitignore was only
applied to the first processed source. The reason is that, in the
first source, exclude is `None`, but then the value gets overridden by
`re_compile_maybe_verbose(DEFAULT_EXCLUDES)`, so in the next iteration
where the source is a directory, the condition is not met and sets the
value of `gitignore` to `None`.

To fix this problem, we store a boolean indicating if `exclude` is
`None` and set the value of `exclude` to its default value if that's
the case. This makes sure that the flow enters the correct condition on
following iterations and also keeps the original value if the condition
is not met.

Also, the value of `gitignore` is initialized as `None` and overriden
if necessary. The value of `root_gitignore` is always calculated to
avoid using additional variables (at the small cost of additional
computations).

Signed-off-by: Antonio Ossa Guerra <aaossa@uc.cl>
CHANGES.md
src/black/__init__.py
tests/data/gitignore_used_on_multiple_sources/.gitignore [new file with mode: 0644]
tests/data/gitignore_used_on_multiple_sources/dir1/a.py [new file with mode: 0644]
tests/data/gitignore_used_on_multiple_sources/dir1/b.py [new file with mode: 0644]
tests/data/gitignore_used_on_multiple_sources/dir2/a.py [new file with mode: 0644]
tests/data/gitignore_used_on_multiple_sources/dir2/b.py [new file with mode: 0644]
tests/test_black.py