[Rev 01] RFR: git-fork: support configuration and more options

Robin Westberg rwestberg at openjdk.java.net
Mon Dec 9 07:40:44 UTC 2019


On Mon, 9 Dec 2019 07:40:24 GMT, Erik Helin <ehelin at openjdk.org> wrote:

>> Hi all,
>> 
>> please review this (large) rewrite of `git-fork`. The command is mostly
>> backwards compatible, but I've added a number of new options (and made them all
>> configurable).
>> 
>> Some particularly nice features:
>> 
>> - support for `--reference` means really fast clone times if you have a similar
>>   repository available locally
>> - support for `--host` means very short command-lines (particularly if you one
>>   configures this flag)
>> - support for the `ssh://` protocol is more natural when cloning a personal fork
>> 
>> All features taken together becomes faily smooth. As an example, consider the
>> following `~/.gitconfig`:
>> 
>> [fork]
>>        ssh = true
>>        host = github.com
>>        reference = ~/git/github.com/openjdk/jdk
>> 
>> _If_ I have a `jdk` repository available at the above path (it doesn't have to
>> be up to date), then a fork of _any_ jdk derived repostiry becomes really fast:
>> 
>> $ time git fork openjdk/panama
>> Fork available at: https://github.com/edvbld/panama
>> Cloning ssh://git@github.com/edvbld/panama.git...
>> Cloning into 'panama'...
>> remote: Enumerating objects: 12082, done.
>> remote: Counting objects: 100% (12082/12082), done.
>> remote: Total 35466 (delta 12082), reused 12082 (delta 12082), pack-reused 23384
>> Receiving objects: 100% (35466/35466), 13.08 MiB | 10.86 MiB/s, done.
>> Resolving deltas: 100% (28691/28691), completed with 1851 local objects.
>> Updating files: 100% (67732/67732), done.
>> Adding remote 'upstream' for https://github.com/openjdk/panama...done
>> 
>> real    0m23.801s
>> user    0m8.834s
>> sys     0m2.959s
>> 
>> I've tested `git-pr` manually and it all seems to hang together ��
>> 
>> Thanks,
>> Erik
> 
> The pull request has been updated with 1 additional commit.

Looks good, just had a few minor text comments!

cli/src/main/java/org/openjdk/skara/cli/GitFork.java line 112:

> 111:                   .describe("DIR")
> 112:                   .helptext("Same as git clones flag 'reference-if-able'")
> 113:                   .optional(),

Suggestion:

                  .helptext("Same as git clone's flag 'reference-if-able'")

cli/src/main/java/org/openjdk/skara/cli/GitFork.java line 230:

> 229:         if (credentials.password() == null) {
> 230:             exit("error: no personal acess token found, use git-credentials or the environment variable GIT_TOKEN");
> 231:         }

Suggestion:

            exit("error: no personal access token found, use git-credentials or the environment variable GIT_TOKEN");

cli/src/main/java/org/openjdk/skara/cli/GitFork.java line 233:

> 232:         if (credentials.username() == null) {
> 233:             exit("error: no username for found, use git-credentials or the flag --username");
> 234:         }

Suggestion:

            exit("error: no username for " + webURI.getHost() + " found, use git-credentials or the flag --username");

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

Marked as reviewed by rwestberg (Reviewer).

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


More information about the skara-dev mailing list