zielu / GitToolBox

GitToolBox IntelliJ plugin
GNU General Public License v3.0
604 stars 71 forks source link

[BUG] Issue key reference complains about finding the same reference it expects #434

Closed mastacheata closed 1 year ago

mastacheata commented 1 year ago

Describe the bug When referencing an issue in the branch name and commit message, with #-prefix the plugin will always complain about issue key mismatch, but then list the very same issue in expected and found.

To Reproduce Steps to reproduce the behavior:

  1. Create a branch i.e.: feature/#1234-some-title
  2. Commit to that branch with a commit message that includes #1234 in the message

Expected behavior No error

Actual behavior The plugin complains about an issue key mismatch, but in the details it shows that it actually found the same issues in the message and branch name.

Plugin version 213.10.2

IDE version PyCharm 2022.3 (Professional Edition) Build #PY-223.7571.203, built on November 30, 2022 Windows 11 22H2

Screenshots issue key mismatch

zielu commented 1 year ago

@mastacheata did you have issue key mentioned 2 times in message by any chance ? From code it looks like this is a possible scenario.

zielu commented 1 year ago

Done in 213.10.3

derula commented 1 year ago

I think the main problem here isn't that the issue name appears in "message references" twice, but that it complains even if you reference the correct issue. I still experience that problem in 213.10.4:

image

(And yes, the CIA'd project keys are the same)

This means that - at least for me - the message will pop up on every single commit, no matter if I reference the correct or incorrect issue key.

@zielu could you have a look at this again, please?

zielu commented 1 year ago

@derula sure, back on it :)

zielu commented 1 year ago

Ok, I think I know what is wrong - issue key text offsets are compared too and it does not make sense. You can have key at start of branch name and at the end of message for example :/

derula commented 1 year ago

For reference, my branch name looks like this: feature/ABC-123 and my commit message: ABC-123 Did something amazing. It used to work fine with this exact setup (I suppose I may have had to configure the branch naming scheme?) and stopped working a few versions back without me changing anything. (I was too lazy to report then...)

zielu commented 1 year ago

I was changing how key matches are represented (adding offsets) in code to support another feature, I believe I broke it around that time.

zielu commented 1 year ago

Done in 213.10.5