Add ->showGitInfo() for displaying git tag and short hash #40
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pxlrbt/filament-environment-indicator!40
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/git-tag-hash"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #27
What
Adds a general
->showGitInfo(Closure)method so the badge can display the git tag and/or short commit hash — not only the branch. This implements the API shape you proposed in #27.The closure receives a
GitInfoinstance (also injectable by type-hint) exposingbranch(),tag()andhash(), and returns the string to render:How
GitInfovalue object resolvesbranch()/tag()/hash()lazily viaexec()(git branch --show-current,git describe --tags --abbrev=0,git rev-parse --short HEAD), caching each lookup. Every lookup degrades tonullwhenexec()is disabled or the command fails.->showGitBranch()is now a thin wrapper over the same mechanism — no behavior change, so existing users are unaffected.->showGitInfo()takes precedence when both are set; because the closure composes any of branch/tag/hash, both can effectively be shown at once.titletooltip on hover, addressing the long-version-number edge case.$branchis still the slot rendered), so published/overridden views keep working.Pull request closed