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

fix git version fail when head is detached #2729

Merged

Conversation

jambun
Copy link
Contributor

@jambun jambun commented Jun 21, 2022

git symbolic-ref -q --short HEAD gives a fatal error on detached HEAD.

so let's try a little harder to get something useful - by giving the checked out tag.

@mark-cooper
Copy link
Member

Hi James, depending on what's going on this can still turn up empty:

git describe --tags --exact-match 
fatal: no tag exactly matches '784cfaf6a4345dcd51aef68ad74180b309348c93'

git describe --debug 
describe HEAD
No exact match on refs or tags, searching to describe ...

So rather than nothing maybe as a final fallback use the abbrev. commit hash?

git symbolic-ref -q --short HEAD || git describe --tags --exact-match 2> /dev/null || git rev-parse -q --short HEAD
784cfaf6a

@jambun
Copy link
Contributor Author

jambun commented Jun 22, 2022

Sounds good @mark-cooper - feel free to do what you will with this.

@mark-cooper mark-cooper merged commit f175231 into archivesspace:master Jun 23, 2022
@cdibella cdibella added the community code contributed by community members not on or contracted by the ArchivesSpace program team label Aug 10, 2022
@cdibella cdibella added this to the 3.3.0 milestone Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community code contributed by community members not on or contracted by the ArchivesSpace program team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants