JetBrains / idea-gitignore

.ignore support plugin for IntelliJ IDEA
Apache License 2.0
1.29k stars 177 forks source link

Certain ignore templates conflict when inserted as a group #614

Closed magneticflux- closed 3 years ago

magneticflux- commented 4 years ago

Prerequisites

Description

When generating .gitignore files, the order of certain blocks invalidates prior blocks because .gitignore files respect the last matching pattern.

Steps to Reproduce

  1. Generate a .gitignore with the Java and Gradle templates
  2. Observe that the Gradle template is generated first
  3. Observe that the !gradle-wrapper.jar pattern is generated before the *.jar pattern

Expected behavior:

The Gradle template is always inserted after the Java template (or any template that would exclude the wrapper file).

Actual behavior:

The Gradle template is inserted before the Java template, making its un-exclusion pattern useless.

Reproduces how often:

100% of the time.

Versions

Plugin:

3.2.3.193

IDE:

IntelliJ IDEA 2019.3 (Ultimate Edition)
Build #IU-193.5233.102, built on November 27, 2019
Licensed to Mitchell Skaggs
Subscription is active until January 9, 2020
For educational use only.
Runtime version: 11.0.4+10-b520.11 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1631M
Cores: 8
Registry: 
Non-Bundled Plugins: Cloak, Lombook Plugin, Pythonid, VisualVMLauncher, com.intellij.nativeDebug, org.jetbrains.kotlin, adb.wifi.woaiwhz, com.almightyalpaca.intellij.plugins.discord, com.demonwav.minecraft-dev, com.dmarcotte.handlebars, com.github.platan.gradle-dependencies-formatter, com.intellij.ideolog, com.intellij.kubernetes, com.intellij.plugins.html.instantEditing, com.intellij.plugins.webcomponents, com.jetbrains.plugins.ini4idea, com.ultrahob.zerolength.plugin, com.wakatime.intellij.plugin, io.protostuff.protostuff-jetbrains-plugin, lermitage.intellij.extra.icons, mobi.hsz.idea.gitignore, nl.rubensten.texifyidea, org.intellij.RegexpTester, org.intellij.scala, org.jetbrains.plugins.hocon, org.jetbrains.plugins.vagrant, org.jetbrains.plugins.vue, org.plugin.dot.id, org.toml.lang, tanvd.grazi, org.rust.lang

OS:

Windows 10 Home v2004 Build 19041.1

Additional Information

hsz commented 3 years ago

@magneticflux- Thanks for reporting. In fact, that's not an issue in the matter of generating the .gitignore file. All the templates come from the official github/gitignore repository. The order of inserting depends on your matches. As a workaround, you may introduce your custom User Template.