Skip to content

Commit 4750ad0

Browse files
committed
Adding HEAD decorator markup in the Graph
1 parent 8aeb7ed commit 4750ad0

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

src/Commands/QueryCommits.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,15 @@ private bool ParseDecorators(List<Models.Decorator> decorators, string data)
146146
Name = d.Substring(19).Trim(),
147147
});
148148
}
149+
else if (d.Equals("HEAD"))
150+
{
151+
isHeadOfCurrent = true;
152+
decorators.Add(new Models.Decorator()
153+
{
154+
Type = Models.DecoratorType.CurrentCommitHead,
155+
Name = d.Trim(),
156+
});
157+
}
149158
else if (d.StartsWith("refs/heads/", StringComparison.Ordinal))
150159
{
151160
decorators.Add(new Models.Decorator()

src/Converters/DecoratorTypeConverters.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public static class DecoratorTypeConverters
3838
});
3939

4040
public static readonly FuncValueConverter<Models.DecoratorType, FontWeight> ToFontWeight =
41-
new FuncValueConverter<Models.DecoratorType, FontWeight>(v => v == Models.DecoratorType.CurrentBranchHead ? FontWeight.Bold : FontWeight.Regular);
41+
new FuncValueConverter<Models.DecoratorType, FontWeight>(v =>
42+
v is Models.DecoratorType.CurrentBranchHead or Models.DecoratorType.CurrentCommitHead
43+
? FontWeight.Bold : FontWeight.Regular
44+
);
4245
}
4346
}

src/Models/Commit.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public bool IsCommitterVisible
3232

3333
public bool IsCurrentHead
3434
{
35-
get => Decorators.Find(x => x.Type == DecoratorType.CurrentBranchHead) != null;
35+
get => Decorators.Find(x => x.Type is DecoratorType.CurrentBranchHead or DecoratorType.CurrentCommitHead) != null;
3636
}
3737

3838
public string FullMessage

src/Models/Decorator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ public enum DecoratorType
77
None,
88
CurrentBranchHead,
99
LocalBranchHead,
10+
CurrentCommitHead,
1011
RemoteBranchHead,
1112
Tag,
1213
}

0 commit comments

Comments
 (0)