Skip to content

gitaly-git2go: Return structured conflict error on merge conflict

Patrick Steinhardt requested to merge pks-git2go-merge-conflict-errors into master

We have recently started efforts to return structured error types from Gitaly RPCs to tell upstream callers why an error was raised, which is going to replace the current approach where error information is passed as plain string in a normal RPC response. The first candidate we're converting is UserMergeBranch.

While it is easy in UserMergeBranch to return error details in case access checks fail, we also want to return details in case the merge failed due to conflicts. The most important info we want to return in this case is which files are conflicting as well as the revisions which do. While we already have info about the revisions, Gitaly currently cannot tell which files were conflicting: this information is only known to gitaly-git2go, and we do not pass up this information in any way.

This MR implements support for gob serialization in gitaly-git2go's merge subcommand. With this in place, it is an easy fix given that we can return "real" errors. This MR thus introduces a new ConflictingFilesError which has a slice of conflicting files as field and returns it in case gob serialization is in use.

Note that we do not yet use this rich information for now, but this change only lays the groundwork. As such, no change in behaviour is expected from this commit.

Part of #3582 (closed)

Merge request reports

Loading