diff --git a/src/Commands/QueryTags.cs b/src/Commands/QueryTags.cs index 0547b396..3aa20dc2 100644 --- a/src/Commands/QueryTags.cs +++ b/src/Commands/QueryTags.cs @@ -7,9 +7,11 @@ namespace SourceGit.Commands { public QueryTags(string repo) { + _boundary = $"----- BOUNDARY OF TAGS {Guid.NewGuid()} -----"; + Context = repo; WorkingDirectory = repo; - Args = "tag -l --sort=-creatordate --format=\"%(refname)%00%(objectname)%00%(*objectname)\""; + Args = $"tag -l --sort=-creatordate --format=\"{_boundary}%(refname)%00%(objectname)%00%(*objectname)%00%(contents:subject)%0a%0a%(contents:body)\""; } public List Result() @@ -19,27 +21,25 @@ namespace SourceGit.Commands if (!rs.IsSuccess) return tags; - var lines = rs.StdOut.Split('\n', StringSplitOptions.RemoveEmptyEntries); - foreach (var line in lines) + var records = rs.StdOut.Split(_boundary, StringSplitOptions.RemoveEmptyEntries); + foreach (var record in records) { - var tag = ParseLine(line); - if (tag != null) - tags.Add(tag); + var subs = record.Split('\0', StringSplitOptions.None); + if (subs.Length != 4) + continue; + + var message = subs[3].Trim(); + tags.Add(new Models.Tag() + { + Name = subs[0].Substring(10), + SHA = string.IsNullOrEmpty(subs[2]) ? subs[1] : subs[2], + Message = string.IsNullOrEmpty(message) ? null : message, + }); } return tags; } - private Models.Tag ParseLine(string line) - { - var subs = line.Split('\0'); - if (subs.Length != 3) - return null; - - var tag = new Models.Tag(); - tag.Name = subs[0].Substring(10); - tag.SHA = string.IsNullOrEmpty(subs[2]) ? subs[1] : subs[2]; - return tag; - } + private string _boundary = string.Empty; } } diff --git a/src/Models/Tag.cs b/src/Models/Tag.cs index c1a34bfa..2ec9e093 100644 --- a/src/Models/Tag.cs +++ b/src/Models/Tag.cs @@ -4,6 +4,7 @@ { public string Name { get; set; } public string SHA { get; set; } + public string Message { get; set; } public bool IsFiltered { get; set; } } } diff --git a/src/ViewModels/TagCollection.cs b/src/ViewModels/TagCollection.cs index adc73b26..ecf13fb4 100644 --- a/src/ViewModels/TagCollection.cs +++ b/src/ViewModels/TagCollection.cs @@ -12,6 +12,11 @@ namespace SourceGit.ViewModels public Models.Tag Tag { get; private set; } = null; public List Children { get; private set; } = []; + public object ToolTip + { + get => Tag?.Message; + } + public bool IsFolder { get => Tag == null; diff --git a/src/Views/BranchTree.axaml b/src/Views/BranchTree.axaml index 6df2dbb8..70c9d8fd 100644 --- a/src/Views/BranchTree.axaml +++ b/src/Views/BranchTree.axaml @@ -33,49 +33,49 @@ ColumnDefinitions="16,*" ToolTip.Tip="{Binding Tooltip}"> - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/src/Views/TagsView.axaml b/src/Views/TagsView.axaml index c0837dac..a30f63de 100644 --- a/src/Views/TagsView.axaml +++ b/src/Views/TagsView.axaml @@ -26,7 +26,8 @@ Margin="{Binding Depth, Converter={x:Static c:IntConverters.ToTreeMargin}}" Background="Transparent" ContextRequested="OnRowContextRequested" - DoubleTapped="OnDoubleTappedNode"> + DoubleTapped="OnDoubleTappedNode" + ToolTip.Tip="{Binding ToolTip}"> - +