Skip to content

Commit ac7ae1e

Browse files
authored
Added \b escape character as per spec (#1399)
1 parent 0fceecb commit ac7ae1e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/Microsoft.Build.Tasks.Git.UnitTests/GitConfigTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ public void ReadSectionHeader_Errors(string str, int unexpectedChar)
350350
[InlineData("name=\"a\rb\"", "name", "a\rb")]
351351
[InlineData("name=\"a\nb\"", "name", "a\nb")]
352352
[InlineData("name=\"a\r\nb\"", "name", "a\r\nb")]
353+
[InlineData("name=\"a\bb\"", "name", "a\bb")]
353354
public void ReadVariableDeclaration(string str, string name, string value)
354355
{
355356
GitConfig.Reader.ReadVariableDeclaration(

src/Microsoft.Build.Tasks.Git/GitDataReader/GitConfig.Reader.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,14 @@ private static string ReadVariableValue(LineCountingReader reader, StringBuilder
577577
lengthIgnoringTrailingWhitespace = builder.Length;
578578
continue;
579579

580+
case 'b':
581+
reader.Read();
582+
builder.Append('\b');
583+
584+
// escaped \b is not considered trailing whitespace:
585+
lengthIgnoringTrailingWhitespace = builder.Length;
586+
continue;
587+
580588
case '\\':
581589
case '"':
582590
builder.Append((char)reader.Read());

0 commit comments

Comments
 (0)