Fix dequote error in "normal" lines

Without this, quotes in normal lines were removed.
This commit is contained in:
Rene Pfeuffer
2019-11-19 10:13:58 +01:00
parent 3a3c27bb67
commit 1d2888f8e6
2 changed files with 3 additions and 2 deletions

View File

@@ -110,6 +110,7 @@ public class GitDiffCommand extends AbstractGitCommand implements DiffCommand {
return; return;
} }
numberOfPotentialBeginning = -1; numberOfPotentialBeginning = -1;
inPotentialQuotedLine = false;
} }
if (inPotentialQuotedLine && i == '"') { if (inPotentialQuotedLine && i == '"') {

View File

@@ -16,7 +16,7 @@ public class GitDiffCommand_DequoteOutputStreamTest {
"--- /dev/null\n" + "--- /dev/null\n" +
"+++ \"b/\\303\\272\\303\\274\\303\\276\\303\\253\\303\\251\\303\\245\\303\\253\\303\\245\\303\\251 \\303\\245g\\303\\260f\\303\\237\"\n" + "+++ \"b/\\303\\272\\303\\274\\303\\276\\303\\253\\303\\251\\303\\245\\303\\253\\303\\245\\303\\251 \\303\\245g\\303\\260f\\303\\237\"\n" +
"@@ -0,0 +1 @@\n" + "@@ -0,0 +1 @@\n" +
"+rthms"; "+String s = \"quotes shall be kept\";";
ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ByteArrayOutputStream buffer = new ByteArrayOutputStream();
GitDiffCommand.DequoteOutputStream stream = new GitDiffCommand.DequoteOutputStream(buffer); GitDiffCommand.DequoteOutputStream stream = new GitDiffCommand.DequoteOutputStream(buffer);
@@ -30,6 +30,6 @@ public class GitDiffCommand_DequoteOutputStreamTest {
"--- /dev/null\n" + "--- /dev/null\n" +
"+++ b/úüþëéåëåé ågðfß\n" + "+++ b/úüþëéåëåé ågðfß\n" +
"@@ -0,0 +1 @@\n" + "@@ -0,0 +1 @@\n" +
"+rthms"); "+String s = \"quotes shall be kept\";");
} }
} }