mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 20:24:59 +00:00
fix: improve line splitting to handle both LF and CRLF line endings (#1106)
This commit is contained in:
parent
a0cddaea80
commit
b930066b5a
2 changed files with 5 additions and 3 deletions
|
@ -16,7 +16,7 @@ namespace SourceGit.Commands
|
||||||
var rs = ReadToEnd();
|
var rs = ReadToEnd();
|
||||||
if (rs.IsSuccess)
|
if (rs.IsSuccess)
|
||||||
{
|
{
|
||||||
var lines = rs.StdOut.Split('\n', StringSplitOptions.RemoveEmptyEntries);
|
var lines = rs.StdOut.Split(['\n', '\r'], StringSplitOptions.RemoveEmptyEntries);
|
||||||
return lines.Length;
|
return lines.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
namespace SourceGit.Commands
|
using System;
|
||||||
|
|
||||||
|
namespace SourceGit.Commands
|
||||||
{
|
{
|
||||||
public class QueryCommitSignInfo : Command
|
public class QueryCommitSignInfo : Command
|
||||||
{
|
{
|
||||||
|
@ -22,7 +24,7 @@
|
||||||
if (raw.Length <= 1)
|
if (raw.Length <= 1)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var lines = raw.Split('\n');
|
var lines = raw.Split(['\n', '\r'], StringSplitOptions.RemoveEmptyEntries);
|
||||||
return new Models.CommitSignInfo()
|
return new Models.CommitSignInfo()
|
||||||
{
|
{
|
||||||
VerifyResult = lines[0][0],
|
VerifyResult = lines[0][0],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue