RFR: 1304: The 'git skara sync' command often fails

Kevin Rushforth kcr at openjdk.java.net
Wed Jan 12 16:16:33 UTC 2022

On Tue, 11 Jan 2022 21:12:42 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

> This is a partial rework of the rather recent change to "git skara fork" and "git skara sync". That patch tried to protect the user from syncing changes to the wrong host unintentionally, but unfortunately, it turned out to make it a bit too hard.
> With this patch I'm fixing some outright bugs as well as dialing back the protection a little bit. First the clear bugfixes:
> 1. When trying to figure out the official fork parent from the origin, setup and use credentials properly.
> 2. When forking and cloning a repository into a sub directory of an existing local repository, do not set the forge.name config in the existing local repository.
> Behavioral changes:
> 1. Do not require --force when explicitly setting --to and/or --from. I believe that if you set those parameters, you are already explicit enough.
> 2. Do require --force whenever the derived to and from do not share the same hostname. This should better catch the sensitive situation when changes are likely to be going the wrong way.
> 3. Since looking up the fork parent from the origin forge is unreliable, only use it when possible and mostly for verification, and only use it as the last option for default from repo.
> So to summarize, here is the expected behavior for choosing the repository from which to sync changes from (this now matches the existing documentation at https://wiki.openjdk.java.net/display/SKARA/git-sync).
> 1. The --from option if set either on the command line or configuration
> 2. A remote named "upstream"
> 3. The fork parent from the origin forge

> I think when it works, it does provide a good extra sanity check. ... so with a correctly configured proxy, it's not noticeably slow now.

OK, good.

> This made me realize that there is a corner case where this patch doesn't work well. If the user has no upstream and runs with just '--force' on the command line, then 'sync' will not find any from repo at all. I could fix this.

Hmm. It looks like it should work with your existing patch, but maybe I'm missing something.


Marked as reviewed by kcr (Reviewer).

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

More information about the skara-dev mailing list