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

Erik Joelsson erikj at openjdk.java.net
Tue Jan 11 21:16:35 UTC 2022


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

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

Commit messages:
 - Fixed comment
 - Fix fork
 - SKARA-1304

Changes: https://git.openjdk.java.net/skara/pull/1273/files
 Webrev: https://webrevs.openjdk.java.net/?repo=skara&pr=1273&range=00
  Issue: https://bugs.openjdk.java.net/browse/SKARA-1304
  Stats: 140 lines in 2 files changed: 69 ins; 42 del; 29 mod
  Patch: https://git.openjdk.java.net/skara/pull/1273.diff
  Fetch: git fetch https://git.openjdk.java.net/skara pull/1273/head:pull/1273

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


More information about the skara-dev mailing list