Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a short_tag attribute to git context #183

Merged
merged 1 commit into from
Oct 25, 2023

Conversation

marcospereira
Copy link
Contributor

@marcospereira marcospereira commented Oct 20, 2023

What?

Fixes #184.

This adds a short_tag attribute to the git context. It WILL NOT interfere with the changes made to fix #143 since there is no "manual' manipulation of the full tag description, but instead, it uses git itself to get the short name.

From git describe --help:

The command finds the most recent tag that is reachable from a commit. If the tag points to the commit, then only the tag is shown. Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object and the abbreviated object name of the most recent commit. The result is a "human-readable" object name which can also be used to identify the commit to other git commands.

And later, when describing --abbrev=0:

With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:

[torvalds@g5 git]$ git describe --abbrev=0 v1.0.5^2
tags/v1.0.0

Why?

This is useful when showing latest release info, for example.

@fralau
Copy link
Owner

fralau commented Oct 20, 2023

Hi, thanks for your contribution!

In line with the project's policy, could I ask you to open an issue detailing the problem you wish to solve (use case, etc.), and link your PR to it?

@marcospereira
Copy link
Contributor Author

In line with the project's policy, could I ask you to open an issue detailing the problem you wish to solve (use case, etc.), and link your PR to it?

Done. See the linked issue. :-)

@marcospereira
Copy link
Contributor Author

Hey, @fralau. Just a gentle reminder about this. Let me know if there are any changes I should make here.

@fralau fralau added the enhancement New feature or request label Oct 25, 2023
Copy link
Owner

@fralau fralau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine to me.

@fralau fralau merged commit 82c5cdd into fralau:master Oct 25, 2023
@marcospereira marcospereira deleted the add-short-tag branch October 25, 2023 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants