Nathan Gray commented on Bug JENKINS-25580

As somebody who has done way too much git scripting I can appreciate how tricky this stuff is, but the plugin is just plain doing the wrong thing. I've specified an unambiguous branch and it's randomly dropped part of the name. I've asked it to poll "origin/release/flow" and it's polling "flow". The "origin" part is correctly removed but what happened to "release"?

Note that this is a regression from the last version of the plugin I used, where "origin/release/flow" did the right thing. I'm not asking for behavior to change, I'm asking for previously working branch names to work again.

Looking at the code, normalizeBranchSpec is broken (and there's even a comment in the code saying so). Taking the last component of the branch name is going to be wrong a lot. I wonder if you're aware that git already provides branch normalization with "git rev-parse --symbolic-full-name":

[nathangray@n8bookpro]% git rev-parse --symbolic-full-name release/flow
refs/heads/release/flow
[nathangray@n8bookpro]% git rev-parse --symbolic-full-name heads/release/flow
refs/heads/release/flow
[nathangray@n8bookpro]% git rev-parse --symbolic-full-name origin/release/flow
refs/remotes/origin/release/flow
[nathangray@n8bookpro]% git rev-parse --symbolic-full-name remotes/origin/release/flow
refs/remotes/origin/release/flow

Couldn't you use that instead of trying to do it yourself?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to