Adding HEAD decorator markup in the Graph

This commit is contained in:
Filipe Ramalho 2024-05-25 15:05:32 -03:00
parent 8aeb7ed17c
commit 4750ad0d07
4 changed files with 15 additions and 2 deletions

View file

@ -146,6 +146,15 @@ namespace SourceGit.Commands
Name = d.Substring(19).Trim(), Name = d.Substring(19).Trim(),
}); });
} }
else if (d.Equals("HEAD"))
{
isHeadOfCurrent = true;
decorators.Add(new Models.Decorator()
{
Type = Models.DecoratorType.CurrentCommitHead,
Name = d.Trim(),
});
}
else if (d.StartsWith("refs/heads/", StringComparison.Ordinal)) else if (d.StartsWith("refs/heads/", StringComparison.Ordinal))
{ {
decorators.Add(new Models.Decorator() decorators.Add(new Models.Decorator()

View file

@ -38,6 +38,9 @@ namespace SourceGit.Converters
}); });
public static readonly FuncValueConverter<Models.DecoratorType, FontWeight> ToFontWeight = public static readonly FuncValueConverter<Models.DecoratorType, FontWeight> ToFontWeight =
new FuncValueConverter<Models.DecoratorType, FontWeight>(v => v == Models.DecoratorType.CurrentBranchHead ? FontWeight.Bold : FontWeight.Regular); new FuncValueConverter<Models.DecoratorType, FontWeight>(v =>
v is Models.DecoratorType.CurrentBranchHead or Models.DecoratorType.CurrentCommitHead
? FontWeight.Bold : FontWeight.Regular
);
} }
} }

View file

@ -32,7 +32,7 @@ namespace SourceGit.Models
public bool IsCurrentHead public bool IsCurrentHead
{ {
get => Decorators.Find(x => x.Type == DecoratorType.CurrentBranchHead) != null; get => Decorators.Find(x => x.Type is DecoratorType.CurrentBranchHead or DecoratorType.CurrentCommitHead) != null;
} }
public string FullMessage public string FullMessage

View file

@ -7,6 +7,7 @@ namespace SourceGit.Models
None, None,
CurrentBranchHead, CurrentBranchHead,
LocalBranchHead, LocalBranchHead,
CurrentCommitHead,
RemoteBranchHead, RemoteBranchHead,
Tag, Tag,
} }