git webrev fails with an IOException if remote isn't named "origin"

Jaikiran Pai jai.forums2013 at gmail.com
Sun Mar 15 12:21:49 UTC 2020


I just started using skara CLI, specifically git webrev, to try out
webrev generation for the JDK project against the github hosted jdk
repo. I followed the skara installation guide[1] to set it up locally.

I then ran the following command against my local checkout of the jdk repo:

git webrev

This consistently fails with the following exception:

Exception in thread "main" java.io.IOException: Unexpected exit code: 128
    at
org.openjdk.skara.vcs/org.openjdk.skara.vcs.git.GitRepository.await(GitRepository.java:103)
    at
org.openjdk.skara.vcs/org.openjdk.skara.vcs.git.GitRepository.commitMetadata(GitRepository.java:233)
    at
org.openjdk.skara.vcs/org.openjdk.skara.vcs.git.GitRepository.commitMetadata(GitRepository.java:269)
    at
org.openjdk.skara.cli/org.openjdk.skara.cli.GitWebrev.generate(GitWebrev.java:214)
    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:360)
    at
org.openjdk.skara.cli/org.openjdk.skara.cli.GitSkara.main(GitSkara.java:127)


Looking into the code of git webrev, hosted in the skara repo and then
manually running the command that it runs, I was able to narrow down
what was causing this issue. It looks like (internally) the skara code
issues:

git rev-list --no-color --no-abbrev origin..HEAD --reverse

(I've not included the --format option, for the sake of simplicity)

Running this above command manually on my setup returns the following error:

fatal: ambiguous argument 'origin..HEAD': unknown revision or path not
in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

and then checking the exit code of that process:

echo $?

shows:

128

So this is the same error the git webrev command is running into.

The root cause appears to be the fact that I've (intentionally) renamed
the logical name of my remote repo to "upstream" and I don't really have
anything called "origin" as my remote repo. Here's the output of:

git remote -v

upstream    https://github.com/openjdk/jdk.git (fetch)
upstream    https://github.com/openjdk/jdk.git (push)

So it looks like the skara CLI code assumes/expects the remote to be
always named "origin".

Is there a better way to report this error?

Furthermore, I see the git webrev command can optionally be passed:

--upstream URL   The URL to the upstream repository

Can the tool be enhanced to optionally take a remote name (like
"upstream" in my case) instead of a URL, thus making it easier to
remember and pass that value instead of passing hard to remember URLs?

[1] https://wiki.openjdk.java.net/display/SKARA/CLI+Tools

-Jaikiran




More information about the skara-dev mailing list