Skip to content

Add squash parameter to git2go merge

Piotr Stankowski requested to merge trakos/gitaly:add-git2go-squash into master

This is a proposal towards possibly gitlab#199711 and #1642 (closed).

This is also related to gitlab#1822 and gitlab#336631 (closed) - in those issues allowing to squash --merge in a single RPC call came up as a prerequisite in some discussions.

In this MR I propose adding git merge --squash equivalent to gitaly-git2go merge command.

In git2go merge command, we calculate the merge index using git_merge_commits. When we create a commit from the tree we can simply set only one parent instead of two, effectively creating a squashed merge commit. This is a slightly different strategy from the currently used rebase squash - it's more similar to regular git merge --squash.

I've added some updated benchmarks in comment !4241 (comment 822638609).

I've added new parameters Squash, CommitterName, CommitterMail and CommitterDate. Obviously, when they're not set it continues to use Author* variables for committer. I've added Committer parameters because for squash commits GitLab uses MR author as commit author, but merging user as committer.

This could be later used to create a new squash merge RPC.

Edited by Piotr Stankowski

Merge request reports