libgit2 / libgit2/libgit2sharp

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

Abierto
#1,982 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
C#
Estrellas
3.5k
Forks
925
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza siguiendo el valor de MergeOptions.TargetLimit desde repo.Merge a través de la operación de merge y compáralo con la forma en que el comando git merge lee merge.renameLimit de .gitconfig. Reproduce el escenario Foo.cs-to-Bar.cs con la disposición de ramas proporcionada y verifica que el merge se complete sin conflictos cuando TargetLimit sea 7000.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
csharp, git
Área
tooling
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.