Add DivergentRefs to UpdateRemoteMirrorResponse
In !1915 (merged), we avoided pushing refs to a remote mirror that had diverged from the local source (assuming keep_divergent_refs
was enabled for the call).
This had the side effect of making it look like a mirror was successful, even if some refs had diverged and weren't even attempted to be pushed.
In order to prevent a "false positive" of a fully-updated mirror, we need to inform the user that some refs weren't pushed at all.
This merge request adds a new field to the UpdateRemoteMirrorResponse
protocol, called DivergentRefs
, which contains the list of refs that weren't attempted to be updated. This is consumed by gitlab-rails in order to properly consider the mirror update a failure, and to enumerate the list of out-of-date refs. See gitlab!29082 (merged).
To avoid excessive memory use and overflowing the response message, we limit the list to the first 100 refs.
Closes #2557 (closed)
964c659a - Add DivergentRefs to UpdateRemoteMirrorResponse
ed09ce34 - Add divergent_refs to UpdateRemoteMirrorResponse
c89769ce - Add a test for DivergentRefs response
fcad0dba - Limit divergent refs returned in response
7e39c969 - Add changelog entry for DivergentRefs response
cfa9564a - Ref
objects receive the canonical_name
from Rugged
The Gitlab::Git::Ref
initializer, which Branch
inherits, already
removes the refs/heads|tags/
prefix from the provided name via
Gitlab::Git.ref_name
, so there should be no functional difference to
providing the "canonical name".
In a future commit, we'll store the canonical name in addition to the non-prefixed name.
57f80a8e - Add Ref#refname
attribute
This exposes the "canonical name" provided from Rugged.
See https://git-scm.com/docs/git-for-each-ref#Documentation/git-for-each-ref.txt-refname