Aha - I have found it. BTW - I was already expecting it to be the tool name itself in the manner you're describing (sorry if I wasn't clear about that).
If I do the following: echo scm.gitTool; scm.gitTool = 'win-git'; echo scm.gitTool; The 1st run through I get Scripts not permitted to use field hudson.plugins.git.GitSCM gitTool After approving the access, it I get "null" printed out twice. However, if you do def myScm = scm; echo myScm.gitTool; myScm.gitTool = 'win-git'; echo myScm.gitTool; It operates as expected! Hurrah! Clearly scm is *actually* a function that returns a 'new' SCM object matching the correct criteria and I've just been caught out by the semantics. On Thu, Jul 28, 2016 at 12:12 PM, Mark Waite <[email protected]> wrote: > I wonder if the sematnics of scm.gitTool are closer to the GitTool object > semantics inside the git plugin. GitTool inside the git plugin allows job > owner to choose which git implementation will be used. It doesn't allow > the job owner to specify the destination of the git executable. > > You might try defining a new git implementation in the "Global Tool > Configuration" under the "Git installations" section. You can set the git > location from that spot in the configuration and give that new git > installation a distinct name ("win-git"). Then assign "win-git" git > scm.gitTool and see if that has the desired affect. > > Mark Waite > > On Thu, Jul 28, 2016 at 12:48 AM Nigel Magnay <[email protected]> > wrote: > >> The host it builds on is not under my control. >> >> Is manipulating fields in scm not supposed to work? >> >> >> On Thursday, 28 July 2016, nicolas de loof <[email protected]> >> wrote: >> >>> Any reason you don't set git in default path ? Would be so simpler ;) >>> Le 27 juil. 2016 10:56 PM, "Nigel Magnay" <[email protected]> a >>> écrit : >>> >>>> No, as it's not on the path so would not be found. >>>> >>>> Oddly, if I do >>>> scm.gitTool = 'win git' >>>> echo scm.gitTool >>>> >>>> it responds with 'null' - so something is odd in the field setter :-/ >>>> >>>> >>>> On Wed, Jul 27, 2016 at 9:53 PM, Mark Waite <[email protected]> >>>> wrote: >>>> >>>>> Have you tried configuring your git executable to be "git" rather than >>>>> "/usr/bin/git"? That's what I've used in multi-platform environments and >>>>> it has worked well for me. >>>>> >>>>> Mark Waite >>>>> >>>>> On Wed, Jul 27, 2016 at 1:57 PM Nigel Magnay <[email protected]> >>>>> wrote: >>>>> >>>>>> In a bitbucket-sourced multibranch repository, I need to ensure the >>>>>> git checkout doesn't occur with /usr/bin/git, but with a tool that >>>>>> stands a >>>>>> chance of executing on Windows. >>>>>> >>>>>> I had rather hoped it would simply be the case of doing >>>>>> >>>>>> scm.gitTool = 'win git'; >>>>>> >>>>>> before my >>>>>> checkout scm >>>>>> >>>>>> But it still seems to insist on using the wrong binary (even though >>>>>> there appears to be a setter, as I had to approve it in the script >>>>>> console). >>>>>> >>>>>> What have I missed? >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Jenkins Users" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to [email protected]. >>>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/d/msgid/jenkinsci-users/CAPYP83SpLOHmoJBupi6Q0QV6TDjKOf9EYtbXrtj3NZ0L9f1PTg%40mail.gmail.com >>>>>> <https://groups.google.com/d/msgid/jenkinsci-users/CAPYP83SpLOHmoJBupi6Q0QV6TDjKOf9EYtbXrtj3NZ0L9f1PTg%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Jenkins Users" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtG8AdnRuA8LX3xSgkpD7p9jepaec%2BjxmaLg7TRZLaBi8A%40mail.gmail.com >>>>> <https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtG8AdnRuA8LX3xSgkpD7p9jepaec%2BjxmaLg7TRZLaBi8A%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Jenkins Users" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/jenkinsci-users/CAPYP83Qxg3RtukcGLL8Ouf43x3VpJmaUS0nr0zsZhFkM1Yr7Yg%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/jenkinsci-users/CAPYP83Qxg3RtukcGLL8Ouf43x3VpJmaUS0nr0zsZhFkM1Yr7Yg%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Jenkins Users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/jenkinsci-users/CANMVJz%3DZceaH3FQZ4B6oXuUaHVtLXTqTjaQjC1ra83Zbgx561A%40mail.gmail.com >>> <https://groups.google.com/d/msgid/jenkinsci-users/CANMVJz%3DZceaH3FQZ4B6oXuUaHVtLXTqTjaQjC1ra83Zbgx561A%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Jenkins Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jenkinsci-users/CAPYP83QHnJeOnUcLhmqa6xkDLXF0_%2BCzY7tz11ma6iXLRrDgbg%40mail.gmail.com >> <https://groups.google.com/d/msgid/jenkinsci-users/CAPYP83QHnJeOnUcLhmqa6xkDLXF0_%2BCzY7tz11ma6iXLRrDgbg%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtFFttqzpi%3DndsnAdQ3XKWbMfEdqs%2BA4WMiDgu5WGg6ePg%40mail.gmail.com > <https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtFFttqzpi%3DndsnAdQ3XKWbMfEdqs%2BA4WMiDgu5WGg6ePg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPYP83S6kc5o4b2tvJQeZze_%2BXoUy%2Btf-8a2CnoKv7vJ8J74kQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
