RFR: 153: Check if origin remote exists before trying to get the pullPath

Jorn Vernee jvernee at openjdk.org
Fri Nov 8 12:09:38 UTC 2019


https://bugs.openjdk.java.net/browse/SKARA-153

Trying to create a webrev in a Git repo that does not have a remote named "origin" causes the following exception:
Exception in thread "main" java.io.IOException: No pull path found for remote origin
        at org.openjdk.skara.vcs/org.openjdk.skara.vcs.git.GitRepository.pullPath(GitRepository.java:934)
        at org.openjdk.skara.cli/org.openjdk.skara.cli.GitWebrev.generate(GitWebrev.java:159)
        at org.openjdk.skara.args/org.openjdk.skara.args.Command.main(Command.java:54)
        at org.openjdk.skara.args/org.openjdk.skara.args.MultiCommandParser.lambda$parse$2(MultiCommandParser.java:64)
        at org.openjdk.skara.cli/org.openjdk.skara.cli.GitWebrev.main(GitWebrev.java:306)
        at org.openjdk.skara.cli/org.openjdk.skara.cli.GitSkara.main(GitSkara.java:127)

It seems that the pullPath is only used to generate a title for the webrev. So, it would be good to check whether the remote exists first, to avoid an exception, and rely on the fallback behaviour of using the filename as a title instead.

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

Commits:
 - 45e6d505: Check if origin remote exists before trying to get the pullPath

Changes: https://git.openjdk.java.net/skara/pull/244/files
 Webrev: https://webrevs.openjdk.java.net/skara/244/webrev.00
  Issue: https://bugs.openjdk.java.net/browse/SKARA-153
  Stats: 11 lines in 1 file changed: 2 ins; 0 del; 9 mod
  Patch: https://git.openjdk.java.net/skara/pull/244.diff
  Fetch: git fetch https://git.openjdk.java.net/skara pull/244/head:pull/244

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


More information about the skara-dev mailing list