libgit2 / libgit2/libgit2sharp
Ignoring whitespaces on diff does not work
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
Expected behavior
When I call:
var options =
new CompareOptions()
{
ContextLines = Int32.MaxValue,
IncludeUnmodified = true,
Similarity =
new SimilarityOptions()
{
WhitespaceMode = WhitespaceMode.IgnoreAllWhitespace
}
};
Console.Write(
repo.Diff.Compare<Patch>(
branch.Tip.Tree,
DiffTargets.Index | DiffTargets.WorkingDirectory,
files,
null,
options
).First().Patch
)
the output is the same as using the git command git diff --ignore-all-space:
diff --git a/test.txt b/test.txt
index d209983..b2c9980 100644
--- a/test.txt
+++ b/test.txt
@@ -1,2 +1,2 @@
I am an initial content
-I am a changeable content
\ No newline at end of file
+I am a different content
\ No newline at end of file
Actual behavior
If have a file "test.txt" with committed content:
I am an inital content
I am a changeable content
and uncommitted content:
I am an inital content
I am a different content
(The first line has some additional whitespaces)
When I call:
var options =
new CompareOptions()
{
ContextLines = Int32.MaxValue,
IncludeUnmodified = true,
Similarity =
new SimilarityOptions()
{
WhitespaceMode = WhitespaceMode.IgnoreAllWhitespace
}
};
Console.Write(
repo.Diff.Compare<Patch>(
branch.Tip.Tree,
DiffTargets.Index | DiffTargets.WorkingDirectory,
files,
null,
options
).First().Patch
)
the output is
diff --git a/test.txt b/test.txt
index d209983..b2c9980 100644
--- a/test.txt
+++ b/test.txt
@@ -1,2 +1,2 @@
-I am an initial content
-I am a changeable content
\ No newline at end of file
+I am an initial content
+I am a different content
\ No newline at end of file
Version of LibGit2Sharp (release number or SHA1)
v0.26.2
Operating system(s) tested; .NET runtime tested
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza reproduciendo el ejemplo de Compare con CompareOptions, SimilarityOptions y WhitespaceMode.IgnoreAllWhitespace; después, compara su salida con git diff --ignore-all-space. Sigue la ruta de comparación de diffs que gestiona los modos de Whitespace. Se considera terminado cuando se ignoran los cambios que solo afectan al Whitespace, mientras que los cambios sustantivos siguen apareciendo en el patch.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- csharp, git
- Área
- devtools
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100