Skip to content

repository: Fix default refspecs force-updating references

The FetchRemote() RPC accepts a which tell it which references should be fetched where. Next to git's normal refspecs, it does understand a bunch of special refspecs which ease its usage for upstream callers which do not care too much about git internals. When such a value is requested, we then simply convert it to something git can understand.

The conversion is currently faulty though: instead of converting these special values to normal refspecs, they're converted to forced refspecs. Which essentially means that even if refs have diverged, we'll always force-update them to the value of the remote repository. While one could argue this to be a feature and not a bug, it becomes clear it's just a bug when one discovers that the RPC also has a Force parameter: only if its set should references be force-updated. But The forced refspecs would just completely ignore whether git-fetch(1) is invoked with --force or not. So together, this simply doesn't make a lot of sense.

Fix the issue by converting special refmap values to unforced refspecs such that the Force parameter does its thing again.

Merge request reports

Loading