Skip to content

tools/git: use --always with git describe#4286

Open
anirudhrb wants to merge 1 commit intomicrosoft:mainfrom
anirudhrb:git_describe_always
Open

tools/git: use --always with git describe#4286
anirudhrb wants to merge 1 commit intomicrosoft:mainfrom
anirudhrb:git_describe_always

Conversation

@anirudhrb
Copy link
Collaborator

If the repository doesn't have tags, git describe fails with:

fatal: No names found, cannot describe anything.

From the official git documentation:

--always
Show uniquely abbreviated commit object as fallback.

This makes our git describe command more robust and prevents exceptions in cases where there are no tags to describe the commit. It is possible that some forked (i.e. not upstream) repositories don't have tags. In these cases, instead of failing, fallback to commit id.

If the repository doesn't have tags, git describe fails with:

  fatal: No names found, cannot describe anything.

From the official git documentation:

--always
  Show uniquely abbreviated commit object as fallback.

This makes our `git describe` command more robust and prevents
exceptions in cases where there are no tags to describe the commit. It
is possible that some forked (i.e. not upstream) repositories don't have
tags. In these cases, instead of failing, fallback to commit id.

Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
@anirudhrb anirudhrb requested a review from LiliDeng as a code owner February 16, 2026 13:08
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