Skip to content

Add --no-deref option to DeleteRefs RPC

By default, git-update-ref resolves the symbolic refs to their following refs beforehand. As a result, deleting a symbolic ref results in deleting its original ref. In most cases, this is not what we want. We want to delete the symbolic ref itself instead. In addition, if both symbolic ref and its following ref are in the same transaction, the update fails to execute. This leads to this annoying problem: gitlab#377951 (closed)

git-update-ref provides --no-deref tag. It disables ref chasing. Symbolic refs themselves are modified. This is a perfect fit for DeleteRef. However, it may be a bad idea to set it as the default value for all ref updating operations. There maybe some side-effect if this flag is enabled by default. So, I create WithNoDeref updater option for DeleteRefs RPC first. In the future, we can expand this flag or enable it by default.

One note. We don't explicitly support symbolic ref. However, Rails side may introduce symbolic ref accidentally because it is quite loose in ref validation. ref resolution was added just some months ago (ceb9161b). From that commit, it's quite sure this problem won't happen anymore. But we still need this flag to clean up troublesome data if any.

Changelog: bug
Closes: #4624 (closed)

Edited by Toon Claes

Merge request reports