mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
fix<Commits>: fix find merged commits in current branch without head
This commit is contained in:
parent
50ad4a0278
commit
31253269aa
1 changed files with 7 additions and 6 deletions
|
@ -121,18 +121,19 @@ namespace SourceGit.Commands {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MarkFirstMerged() {
|
private void MarkFirstMerged() {
|
||||||
Args = $"log --since=\"{commits.Last().Committer.Time}\" --min-parents=2 --format=\"%H\"";
|
Args = $"log --since=\"{commits.Last().Committer.Time}\" --format=\"%H\"";
|
||||||
|
|
||||||
var rs = ReadToEnd();
|
var rs = ReadToEnd();
|
||||||
var shas = rs.Output.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
var shas = rs.Output.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
if (shas.Length == 0) return;
|
if (shas.Length == 0) return;
|
||||||
|
|
||||||
var merges = commits.Where(x => x.Parents.Count > 1).ToList();
|
var set = new HashSet<string>();
|
||||||
foreach (var sha in shas) {
|
foreach (var sha in shas) set.Add(sha);
|
||||||
var c = merges.Find(x => x.SHA == sha);
|
|
||||||
if (c != null) {
|
foreach (var c in commits) {
|
||||||
|
if (set.Contains(c.SHA)) {
|
||||||
c.IsMerged = true;
|
c.IsMerged = true;
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue