-
-
Notifications
You must be signed in to change notification settings - Fork 893
Allow the release info build script to work without requiring Git to be installed #3105
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
Conversation
if !gh.trim().is_empty() { | ||
gh.trim().to_string() | ||
} else { | ||
git_or_unknown(&["rev-parse", "--abbrev-ref", "HEAD"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why --abbrev-ref
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns a commit hash otherwise. But I could also use name-rev like you did before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it return if not a commit hash?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Branch name. (Rev short name if you want to use git wording)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should aim to always have a commit hash so it's possible to actually look up which commit a build link belongs to. (This is also something we don't do on https://editor.graphite.rs but should do.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit hash is collected in the statement above. There rev-parse without --abbrev-ref.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this second one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Collect commit hash
let commit_hash = env_or_else("GRAPHITE_GIT_COMMIT_HASH", || git_or_unknown(&["rev-parse", "HEAD"]));
// Collect Branch name
let commit_branch = env_or_else("GRAPHITE_GIT_COMMIT_BRANCH", || {
let gh = env::var("GITHUB_HEAD_REF").unwrap_or_default();
// Code you comment on is used to collect the branch name when it is not set by GitHub locally for now example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I wasn't looking closely enough. Disregard my last two comments. Anyway, I think we're good to merge.
len("unkonwn") < 8
)