Thanks to visit codestin.com
Credit goes to docs.emacsmirror.org


6 Patching drones

By using Borg you can not only make changes to assimilated packages, you can also keep track of those patches and share them with others.

If you created some commits in a drone repository and are the maintainer of the respective package, then you can just push your changes to the "origin" remote.

You don’t have to do it every time you created some commits, but at important checkpoints, such as after creating a release, you should record the changes in the ~/.config/emacs repository. To do so proceed as described in Updating drones.

But for most packages you are not the maintainer and if you create commits for such drones, then you have to create a fork and push there instead. You should configure that remote as the push-remote using git config remote.pushDefault FORK, or by pressing b C M-p in Magit. After you have done that, you can continue to pull from the upstream using F u in Magit and you can also push to your fork using P p.

Of course you should also occasionally record the changes in the ~/.config/emacs repository. Additionally, and ideally when you first fork a drone, you should also record information about your personal remote in the super-repository by setting submodule.DRONE.remote.

The following variables should be set in ~/.config/emacs/.gitremotes.

Variable: submodule.DRONE.remote NAME URL

This variable specifies an additional remote named NAME that is fetched from URL. This variable can be specified multiple times. Note that NAME URL is a single value and that the two parts of that value are separated by a space.

make bootstrap automatically adds all remotes that are specified like this to the DRONE repository by setting remote.NAME.url to URL and using the standard value for remote.NAME.fetch.

Variable: submodule.setupMirror BOOLEAN
Variable: submodule.DRONE.setupMirror BOOLEAN

Setting the first variable to true causes a remote named mirror, which tracks the repository on the Emacsmirror, to be added for all or most drone. If a DRONE is not mirrored, then the second variable can be set to false. That variable can also be set to true to only add a mirror remote for that DRONE (submodule.DRONE.remote could be used instead).

Adding a mirror remote for all or some drones is particularly useful if the upstreams of certain drones are unreliable. If the upstream is down but the mirror is not, then the drone can still be set up.

Variable: remote.pushDefault FORK

This variable specifies a name used for push-remotes. Because this variable can only have one value it is recommended that you use the same name, FORK, for your personal remote in all drone repositories in which you have created patches that haven’t been merged into the upstream repository (yet). A good value may be your username.

For all drones for which one value of submodule.DRONE.remote specifies a remote whose NAME matches FORK, make bootstrap automatically configures FORK to be used as the push-remote by setting remote.pushDefault to FORK in .git/modules/DRONE/config.

Variable: remote.pushMatch PATTERN

While the previous variable is useful to configure your fork as the push-remote, the purpose of this variable is to set the push-remote for upstream repositories you own.

This variable can be specified multiple times. Each glob PATTERN should match a single account on a single host.

As an example, this is how I combine the above variables:

[remote]
        pushDefault = tarsius
        pushMatch = codeberg.org?tarsius/
        pushMatch = github.com?tarsius/
        pushMatch = github.com?tarsiiformes/
        pushMatch = github.com?emacscollective/
        pushMatch = github.com?magit/
        setupMirror = true
[submodule "wip"] # local private utilities
        setupMirror = false

Hosts and account names are separated using ? because depending on what protocol either / or : must be matched. The trailing / avoids matching other accounts that begin with the name of one of my accounts.