Skip to content

Small improvement on GitBranchHash which is able to get at least the hash of a detached HEAD - #3334

Merged
lkishalmi merged 1 commit into
apache:masterfrom
lkishalmi:fix-git-branchhash-tag
Nov 26, 2021
Merged

Small improvement on GitBranchHash which is able to get at least the hash of a detached HEAD#3334
lkishalmi merged 1 commit into
apache:masterfrom
lkishalmi:fix-git-branchhash-tag

Conversation

@lkishalmi

Copy link
Copy Markdown
Contributor

Fix from an unmerged commit #3151.

@lkishalmi lkishalmi added this to the NB13 milestone Nov 25, 2021

@neilcsmith-net neilcsmith-net left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good. Always meant to go back and look at this. Ideally we'd pick up the branch from the hash - at least all release hashes are only on one branch - or maybe get the branch from the json file if any matching hash. Would make building from tags work correctly.

String revline = revlines.get(0);
if(revline.length()>=12){
hash = revline.trim();
if (!line.contains(":") && (line.length() == 40)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure if this should be >= 40 and also trimmed? I have also no idea if >= 12 was just copying from HgID or necessary. 🤷

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I do not know that either. Just made some adjustments to work with a detached head.

@lkishalmi
lkishalmi merged commit 7c345e9 into apache:master Nov 26, 2021
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