fix: sometimes %ct of branch returns empty string (#1715)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo
2025-08-11 19:06:31 +08:00
parent fd9da43414
commit 6a8bde412a
2 changed files with 8 additions and 2 deletions

View File

@@ -94,8 +94,11 @@ namespace SourceGit.Commands
branch.IsLocal = true;
}
ulong committerDate = 0;
ulong.TryParse(parts[1], out committerDate);
branch.FullName = refName;
branch.CommitterDate = ulong.Parse(parts[1]);
branch.CommitterDate = committerDate;
branch.Head = parts[2];
branch.IsCurrent = parts[3] == "*";
branch.Upstream = parts[4];

View File

@@ -34,13 +34,16 @@ namespace SourceGit.Commands
if (!string.IsNullOrEmpty(message) && message.Equals(name, StringComparison.Ordinal))
message = null;
ulong creactorDate = 0;
ulong.TryParse(subs[5], out creactorDate);
tags.Add(new Models.Tag()
{
Name = name,
IsAnnotated = subs[1].Equals("tag", StringComparison.Ordinal),
SHA = string.IsNullOrEmpty(subs[3]) ? subs[2] : subs[3],
Creator = Models.User.FindOrAdd(subs[4]),
CreatorDate = string.IsNullOrEmpty(subs[5]) ? 0 : ulong.Parse(subs[5]),
CreatorDate = creactorDate,
Message = message,
});
}