ux: add a warning icon when the tracking upstream of a local branch is gone (#1006)

Co-authored-by: Davide Tentori <dtentori@softeam.it>
This commit is contained in:
leo 2025-02-20 10:12:12 +08:00
parent 0e1dfba7ef
commit 53f591bdad
No known key found for this signature in database
7 changed files with 32 additions and 4 deletions

View file

@ -25,11 +25,22 @@ namespace SourceGit.Commands
return branches;
var lines = rs.StdOut.Split('\n', StringSplitOptions.RemoveEmptyEntries);
var remoteBranches = new HashSet<string>();
foreach (var line in lines)
{
var b = ParseLine(line);
if (b != null)
{
branches.Add(b);
if (!b.IsLocal)
remoteBranches.Add(b.FullName);
}
}
foreach (var b in branches)
{
if (b.IsLocal && !string.IsNullOrEmpty(b.Upstream))
b.IsUpsteamGone = !remoteBranches.Contains(b.Upstream);
}
return branches;
@ -75,6 +86,7 @@ namespace SourceGit.Commands
branch.Head = parts[1];
branch.IsCurrent = parts[2] == "*";
branch.Upstream = parts[3];
branch.IsUpsteamGone = false;
if (branch.IsLocal && !string.IsNullOrEmpty(parts[4]) && !parts[4].Equals("=", StringComparison.Ordinal))
branch.TrackStatus = new QueryTrackStatus(WorkingDirectory, branch.Name, branch.Upstream).Result();