libgit2 / libgit2/libgit2sharp

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

Aperta
#1,982 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
C#
Stelle
3.5k
Fork
925
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia tracciando il valore di MergeOptions.TargetLimit da repo.Merge attraverso l’operazione di merge, confrontandolo con il modo in cui il comando git merge legge merge.renameLimit da .gitconfig. Riproduci lo scenario Foo.cs-to-Bar.cs con la disposizione dei branch fornita e verifica che il merge venga completato senza conflitti quando TargetLimit è 7000.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp, git
Ambito
tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.