mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
refactor: rewrite the way reading full message of commit
This commit is contained in:
parent
a99bd2e973
commit
751991c816
2 changed files with 11 additions and 8 deletions
|
@ -52,28 +52,31 @@ namespace SourceGit.Commands
|
||||||
_current.Commit.CommitterTime = ulong.Parse(line);
|
_current.Commit.CommitterTime = ulong.Parse(line);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (line.Equals(_boundary, StringComparison.Ordinal))
|
var boundary = rs.StdOut.IndexOf(_boundary, end + 1);
|
||||||
|
if (boundary > end)
|
||||||
{
|
{
|
||||||
nextPartIdx = -1;
|
_current.Message = rs.StdOut.Substring(start, boundary - start - 1);
|
||||||
_current.Message = _current.Message.Trim();
|
end = boundary + _boundary.Length;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_current.Message = _current.Message + "\n" + line;
|
_current.Message = rs.StdOut.Substring(start);
|
||||||
|
end = rs.StdOut.Length - 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nextPartIdx = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
nextPartIdx++;
|
nextPartIdx++;
|
||||||
|
|
||||||
start = end + 1;
|
start = end + 1;
|
||||||
|
if (start >= rs.StdOut.Length - 1)
|
||||||
|
break;
|
||||||
|
|
||||||
end = rs.StdOut.IndexOf('\n', start);
|
end = rs.StdOut.IndexOf('\n', start);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_current != null)
|
|
||||||
_current.Message = _current.Message.Trim();
|
|
||||||
|
|
||||||
return _commits;
|
return _commits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ namespace SourceGit.Views
|
||||||
if (change.Property == TextProperty && _changingWay == TextChangeWay.None)
|
if (change.Property == TextProperty && _changingWay == TextChangeWay.None)
|
||||||
{
|
{
|
||||||
_changingWay = TextChangeWay.FromSource;
|
_changingWay = TextChangeWay.FromSource;
|
||||||
var normalized = Text.ReplaceLineEndings("\n").Trim();
|
var normalized = Text.ReplaceLineEndings("\n");
|
||||||
var subjectEnd = normalized.IndexOf("\n\n", StringComparison.Ordinal);
|
var subjectEnd = normalized.IndexOf("\n\n", StringComparison.Ordinal);
|
||||||
if (subjectEnd == -1)
|
if (subjectEnd == -1)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue