git-plugin icon indicating copy to clipboard operation
git-plugin copied to clipboard

Retrieve full name matches over hazy short hash matches

Open RoahNo opened this issue 1 year ago • 2 comments

JENKINS-62592 - Return exact matches over fuzzy short hash matches while retrieving revisions.

Not a large change, but this issue addresses the problem arisen by the associated ticket (https://issues.jenkins.io/browse/JENKINS-62592). Commonly, we have seen due to our tagging method/branch name method that we will clash with the hazy short hash revision matching functionality within the AbstractGitSCMSource.retrieve method.

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. This is simply a reminder of what we are going to look for before merging your code. If a checkbox or line does not apply to this pull request, delete it. We prefer all checkboxes to be checked before a pull request is merged

  • [x] I have read the CONTRIBUTING doc
  • [x] I have referenced the Jira issue related to my changes in one or more commit messages
  • [x] I have added tests that verify my changes
  • [x] Unit tests pass locally with my changes
  • [x] I have added documentation as necessary
  • [x] No Javadoc warnings were introduced with my changes
  • [x] No spotbugs warnings were introduced with my changes
  • [x] Documentation in README has been updated as necessary
  • [x] Online help has been added and reviewed for any new or modified fields
  • [x] I have interactively tested my changes
  • [x] Any dependent changes have been merged and published in upstream modules (like git-client-plugin)

Types of changes

What types of changes does your code introduce? Put an x in the boxes that apply. Delete the items in the list that do not apply

  • [x] Bug fix (non-breaking change which fixes an issue)

Further comments

Change can be summarized and seen in the associated test - instead of returning null when we first clash based on short hash, we store that we have noticed a collision and continue on. This way, if we find a full match, we can return what we see as the expected revision to retrieve.

Let me know if there are any comments or concerns that I am over looking and I look forward to helping in any way I can in this project! Thanks!

RoahNo avatar Jul 19 '22 18:07 RoahNo

Will this get merged in? I could really use it, the plugin is not select the correct git ref and this looks like it fixes it!

markhatchell avatar Sep 26 '22 14:09 markhatchell

Will this get merged in? I could really use it, the plugin is not select the correct git ref and this looks like it fixes it!

Not immediately. It has not been reviewed. I did a cursory review and the change looks like a very good start. It includes an automated test (very good). However, it also makes changes that are contrary to the guidelines in the contributing guide (changing white space unnecessarily) and contrary to the guidelines in the SCM API code style guidelines (wild card imports). It will need changes before it is merged.

I have several other reviews that are in my queue ahead of this review.

You could help by installing the incremental build of the plugin in your environment and confirming that it resolves the issue you are seeing and does not have any unexpected side effects.

If you use configuration as code, you can insert this incremental build into your plugins.txt file with the line:

git-client:incrementals;org.jenkins-ci.plugins;git-4.12.2-rc4876.6242d5a_cd5d5

MarkEWaite avatar Sep 26 '22 14:09 MarkEWaite