RFR: Fix parsing of editor commandline in git-pr

Erik Helin ehelin at openjdk.java.net
Tue Feb 11 07:37:36 UTC 2020


On Mon, 10 Feb 2020 22:30:18 GMT, Christoph Langer <clanger at openjdk.org> wrote:

>> @RealCLanger did you see mine and Robin's comments?
> 
> Hi,
> 
> finally I got back to this.
> 
>> As for the regular expression, could you please add a comments above with a few examples.
> 
> I've done that.
> 
>> Also, do you really need the quotation marks around the path to `notepad.exe` for `core.editor`? Won't the following suffice:
>> 
>> ```
>> core.editor = C:\Program Files\Notepad++\notepad++.exe -multiInst -notabbar -nosession -noPlugin
> 
> Probably yes, but that's how I found my git configuration without manual changes that I'm aware of. So it should work. And I think, even if I remove the quotation marks, it still wouldn't work.
> 
> Please review :)

Thanks Christopher! I agree, if it is possible to have quotation marks around the binary in `core.editor`, then we should support that. Looking at your patch, what do you think about doing something perhaps a bit simpler than a regular expression:

var parts = editor.split(" ");
if (parts.length > 0) {
    var binary = parts[0];
    // Binary might be wrapped in quotes on Windows
    if (binary.startsWith(""") && binary.endsWith(""")) {
        parts[0] = binary.substring(1, binary.length() - 1);
    }
}
var pb = new ProcessBuilder(parts);

-------------

PR: https://git.openjdk.java.net/skara/pull/259


More information about the skara-dev mailing list