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

Jaikiran Pai jai.forums2013 at gmail.com
Thu Mar 19 02:50:02 UTC 2020


Hello Erik,

Thank you for that fix. I just pulled that PR locally and included it in
my local skara repo and built it afresh. I then ran it against my local
jdk repo without any remote named "origin". This time it all went fine
and the webrev was generated without issues.

-Jaikiran

On 18/03/20 9:43 pm, Erik Helin wrote:
> Thanks for the bug report Jaikiran!
>
> I created a patch for the problem, please see:
>
>     https://github.com/openjdk/skara/pull/517
>
> I think the above patch should solve the issues you are experiencing.
> If you ever run to such issues again, then a workaround is also to
> manually specify a revision to compare against with --rev.
>
> Thanks,
> Erik
>
> On 3/15/20 1:21 PM, Jaikiran Pai wrote:
>> 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