mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
optimize: only parse track status for local branch
This commit is contained in:
parent
7a867e3ccb
commit
c14b7ebbe1
1 changed files with 13 additions and 6 deletions
|
@ -11,11 +11,22 @@ namespace SourceGit.Commands {
|
|||
public QueryBranches(string repo) {
|
||||
WorkingDirectory = repo;
|
||||
Context = repo;
|
||||
Args = "branch -l --all -v --format=\"%(refname)$%(objectname)$%(HEAD)$%(upstream)$(upstream:trackshort)\"";
|
||||
Args = "branch -l --all -v --format=\"%(refname)$%(objectname)$%(HEAD)$%(upstream)$%(upstream:trackshort)\"";
|
||||
}
|
||||
|
||||
public List<Models.Branch> Result() {
|
||||
Exec();
|
||||
|
||||
foreach (var b in _branches) {
|
||||
if (b.IsLocal && !string.IsNullOrEmpty(b.UpstreamTrackStatus)) {
|
||||
if (b.UpstreamTrackStatus == "=") {
|
||||
b.UpstreamTrackStatus = string.Empty;
|
||||
} else {
|
||||
b.UpstreamTrackStatus = ParseTrackStatus(b.Name, b.Upstream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _branches;
|
||||
}
|
||||
|
||||
|
@ -47,11 +58,7 @@ namespace SourceGit.Commands {
|
|||
branch.Head = parts[1];
|
||||
branch.IsCurrent = parts[2] == "*";
|
||||
branch.Upstream = parts[3];
|
||||
|
||||
if (!string.IsNullOrEmpty(parts[4]) && !parts[4].Equals("=")) {
|
||||
branch.UpstreamTrackStatus = ParseTrackStatus(branch.FullName, branch.Upstream);
|
||||
}
|
||||
|
||||
branch.UpstreamTrackStatus = parts[4];
|
||||
_branches.Add(branch);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue