Skip to content

Commit b930066

Browse files
authored
fix: improve line splitting to handle both LF and CRLF line endings (#1106)
1 parent a0cddae commit b930066

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Commands/CountLocalChangesWithoutUntracked.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public int Result()
1616
var rs = ReadToEnd();
1717
if (rs.IsSuccess)
1818
{
19-
var lines = rs.StdOut.Split('\n', StringSplitOptions.RemoveEmptyEntries);
19+
var lines = rs.StdOut.Split(['\n', '\r'], StringSplitOptions.RemoveEmptyEntries);
2020
return lines.Length;
2121
}
2222

src/Commands/QueryCommitSignInfo.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace SourceGit.Commands
1+
using System;
2+
3+
namespace SourceGit.Commands
24
{
35
public class QueryCommitSignInfo : Command
46
{
@@ -22,7 +24,7 @@ public Models.CommitSignInfo Result()
2224
if (raw.Length <= 1)
2325
return null;
2426

25-
var lines = raw.Split('\n');
27+
var lines = raw.Split(['\n', '\r'], StringSplitOptions.RemoveEmptyEntries);
2628
return new Models.CommitSignInfo()
2729
{
2830
VerifyResult = lines[0][0],

0 commit comments

Comments
 (0)