libgit2 / libgit2/libgit2sharp

MergeOptions: TargetLimit (merge.renameLimit) is being ignored during merge operation

オープン
#1,982 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
C#
スター
3.5k
フォーク
925
PR マージ指標
30日以内にマージされた PR はありません

説明

Reproduction steps

The sourceBranch and targetBranch has a commonAncestorCommit with an existing file Foo.cs. A lot of (let's say: 3000) other files exist too.

The sourceBranch contains one single extra commit on top of commonAncestorCommit with a modification inside a file Foo.cs.

The targetBranch (current branch) contains one single extra commit on top of commonAncestorCommit in which the file Foo.cs has been renamed to Bar.cs, and a lot of (let's say: 2000) other files have also been renamed.

The following merge from sourceBranch to targetBranch ignores TargetLimit (merge.renameLimit), and causes an unnecessary conflict:

using (var repo = new Repository(...))
{
    Commands.Checkout(repo, targetBranch);
    var mergeOptions = new MergeOptions { TargetLimit = 7000 };
    repo.Merge(sourceBranch, mergerSignature, mergeOptions)
}
Expected behavior

A successful merge without conflict.

Actual behavior

We are staying in the ongoing merge operation, and the git status reports conflict for the file Foo.cs stating that it has been "deleted by us".

Note that the plain git merge command can merge this without conflicts if the merge.renameLimit setting is set to 7000 in the .gitconfig file.

Version of LibGit2Sharp (release number or SHA1)

LibGit2Sharp 0.26.2
LibGit2Sharp 0.27.0-preview-0182

Operating system(s) tested; .NET runtime tested

Windows 10 Enterprise N
.NET 6.0.8

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、repo.Merge からマージ操作を通じて MergeOptions.TargetLimit の値を追跡し、git merge コマンドが .gitconfig から merge.renameLimit を読み取る方法と比較します。提供されたブランチ構成で Foo.cs-to-Bar.cs のシナリオを再現し、TargetLimit が 7000 の場合にマージが競合なく完了することを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp, git
領域
tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。