libgit2 / libgit2/libgit2sharp
Ignoring whitespaces on diff does not work
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C#
- Sterne
- 3.5k
- Forks
- 925
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, das Compare-Beispiel mit CompareOptions, SimilarityOptions und WhitespaceMode.IgnoreAllWhitespace nachzubilden, und vergleiche dann seine Ausgabe mit git diff --ignore-all-space. Verfolge den Diff-Vergleichspfad, der Whitespace-Modi verarbeitet. Als abgeschlossen gilt die Aufgabe, wenn Änderungen, die ausschließlich aus Whitespace bestehen, ignoriert werden, während substanzielle Änderungen weiterhin im Patch erscheinen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- csharp, git
- Bereich
- devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100