Skip to content

Commit 6a8bde4

Browse files
committed
fix: sometimes %ct of branch returns empty string (#1715)
Signed-off-by: leo <[email protected]>
1 parent fd9da43 commit 6a8bde4

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/Commands/QueryBranches.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,11 @@ private Models.Branch ParseLine(string line)
9494
branch.IsLocal = true;
9595
}
9696

97+
ulong committerDate = 0;
98+
ulong.TryParse(parts[1], out committerDate);
99+
97100
branch.FullName = refName;
98-
branch.CommitterDate = ulong.Parse(parts[1]);
101+
branch.CommitterDate = committerDate;
99102
branch.Head = parts[2];
100103
branch.IsCurrent = parts[3] == "*";
101104
branch.Upstream = parts[4];

src/Commands/QueryTags.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,16 @@ public QueryTags(string repo)
3434
if (!string.IsNullOrEmpty(message) && message.Equals(name, StringComparison.Ordinal))
3535
message = null;
3636

37+
ulong creactorDate = 0;
38+
ulong.TryParse(subs[5], out creactorDate);
39+
3740
tags.Add(new Models.Tag()
3841
{
3942
Name = name,
4043
IsAnnotated = subs[1].Equals("tag", StringComparison.Ordinal),
4144
SHA = string.IsNullOrEmpty(subs[3]) ? subs[2] : subs[3],
4245
Creator = Models.User.FindOrAdd(subs[4]),
43-
CreatorDate = string.IsNullOrEmpty(subs[5]) ? 0 : ulong.Parse(subs[5]),
46+
CreatorDate = creactorDate,
4447
Message = message,
4548
});
4649
}

0 commit comments

Comments
 (0)