Skip to content

Conversation

goran-w
Copy link
Contributor

@goran-w goran-w commented May 12, 2025

The QueryTags command now additionally reads the %(objecttype) field, which allows us to distinguish between Lightweight tags and Annotated tags.

A new icon is applied for Annotated tags, almost everywhere - except for Models.Decorator and Models.Filter, since these are not (yet) updated to discern the specific tag type. Nevertheless, this change makes it much easier to distinguish if a tag is Annotated or Lightweight.

Also, it's now easier to understand if the tooltip tag-message comes from the (Annotated) tag itself or from the (Lightweight) tag's corresponding commit.

Finally, a Border is added around the TextBlock of items in the TAGS list, to make its message-tooltip work more similar to the ref-tooltip in the LOCAL BRANCHES and REMOTES lists.

@love-linger
Copy link
Collaborator

The commit 6a5e6d1 has been cherry-picked.

Regarding the icons for tags, I've decided to keep them consistent. Whether a tag is annotated or lightweight, its functionality remains unaffected.

Also, when retrieving the tag list, for annotated tags, we always prefer to point the SHA property to the referenced commit rather than the tag's own object. See line 35 of the code:

tags.Add(new Models.Tag()
{
Name = subs[0].Substring(10),
SHA = string.IsNullOrEmpty(subs[2]) ? subs[1] : subs[2],
CreatorDate = ulong.Parse(subs[3]),
Message = string.IsNullOrEmpty(message) ? null : message,
});

What SourceGit needs to do is to correctly display the tag's message and, upon click, correctly locate the referenced commit.

Most other git clients do not distinguish between these two types of tags either. Introducing different tag icons actually increases the user's cognitive cost (in fact, there's no place to inform users why there are two types of icons).

@goran-w
Copy link
Contributor Author

goran-w commented May 13, 2025

I see. Could we PLEASE then instead indicate, only in the tag-message tooltip itself, by an icon and/or by a prefix text like "[Annotated:]" and "[Log:]" (or similar) respectively, where the message comes from?

The new icon is applied everywhere - except for Models.Decorator and Models.Filter, since these are not (yet) updated to discern the specific tag type.
@goran-w goran-w force-pushed the separate_icon_for_annotated_tag branch from 6a5e6d1 to 47fa073 Compare May 13, 2025 04:07
love-linger added a commit that referenced this pull request May 13, 2025
@love-linger
Copy link
Collaborator

Done.

  • annotated tag
    image
  • lightweight tag
    image

@goran-w goran-w deleted the separate_icon_for_annotated_tag branch May 13, 2025 04:39
@goran-w
Copy link
Contributor Author

goran-w commented May 13, 2025

Thanks, @love-linger - looks great! Just a note: the "annotated" string will need to be localized...

@goran-w
Copy link
Contributor Author

goran-w commented May 13, 2025

Also, maybe omit the duplicated tag-name (on the message line) for a lightweight tag, if the commit-message is actually empty?
image

@love-linger
Copy link
Collaborator

Also, maybe omit the duplicated tag-name (on the message line) for a lightweight tag, if the commit-message is actually empty?

Can you test the output of git command in QueryTags for the empty-commit?

@goran-w
Copy link
Contributor Author

goran-w commented May 13, 2025

Can you test the output of git command in QueryTags for the empty-commit?

Ah, Git itself seems to respond with the tag-name if the (lightweight) commit-message is empty, and even when the (annotated) tag-message is empty!

Thus, to avoid the duplication we would need to compare the stripped message to the (isolated) tag-name and clear the message if they are identical...

@goran-w
Copy link
Contributor Author

goran-w commented May 13, 2025

Thank you, it now works like a charm!

And just for the record - my test result above was half wrong, but the fix is relevant nonetheless:
For a lightweight tag, an empty commit-message is returned as-is (empty) by Git.
(But for an annotated tag without a tag-message, Git will indeed return the tag-name, as I reported.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants