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

[Basic] Revise version printing #32345

Merged
merged 1 commit into from
Jun 16, 2020
Merged

Conversation

davezarzycki
Copy link
Contributor

Now that we use the LLVM mono-repo, we don't need to worry about clang's version number. Also, git has the ability to estimate the safe number of digits a hash can be truncated to and now git estimates that large projects like LLVM and Linux "require" 12 digits for safe commit hash abbreviation. Let's stay a little ahead of the curve and statically truncate to 15.

@davezarzycki
Copy link
Contributor Author

@swift-ci please smoke test

@davezarzycki
Copy link
Contributor Author

An aside / digression: I'd not bother truncation the git hashes. Yes, truncation is useful when using git with --oneline output but that isn't this scenario.

  1. People are just going to double-click, copy, and paste so length doesn't matter.
  2. Only devs and testers should see the hashes and they can deal with line wrap.

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

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

Hmm, like a reasonable thing, but I would prefer that if we do this, we update the build to avoid the clang version definition in the generated file.

Any reason to not just use the full abbreviated hash from git?

@davezarzycki
Copy link
Contributor Author

What do you mean by "full abbreviated hash"? That sounds like a contradiction :-)

@davezarzycki
Copy link
Contributor Author

No longer generating/including ClangRevision.inc.

I'd still like people to consider not truncating the git hashes, but I don't feel strongly about this.

@swift-ci please smoke test

@compnerd
Copy link
Member

compnerd commented Jun 12, 2020

What do you mean by "full abbreviated hash"? That sounds like a contradiction :-)

Haha, fair point. What I meant is that rather than truncating in the code to some limit why not print the exact result of git log -1 --pretty=%h. Let git decide what the number of characters should be - if thats 12 then its 12. We don't know whats going on with the SCM and we shouldn't really care either.

I agree with your point that we shouldn't bother truncating to some "safe" amount. But we can have the best of the both worlds as git knows how to print the short form too.

@davezarzycki
Copy link
Contributor Author

I think this is one of those scenarios where it's easy to over-think a problem. I'd vote for just doing the full hash, and see when/if people complain. If people do, then we can address the complaints rather than speculate.

@compnerd
Copy link
Member

That also seems fine by me. I’m also okay with you doing that in a follow up change if you would like.

@davezarzycki
Copy link
Contributor Author

I think we should get someone at Apple to review this given the output of the REPL on my macOS box

@compnerd
Copy link
Member

CC: @JDevlieghere @adrian-prantl

lib/Basic/Version.cpp Outdated Show resolved Hide resolved
Now that we use the LLVM mono-repo, we don't need to worry about clang's
version number. Also, git has the ability to estimate the safe number of
digits a hash can be truncated to and now git estimates that large
projects like LLVM and Linux "require" 12 digits for safe commit hash
abbreviation. Let's stay a little ahead of the curve and statically
truncate to 15.
@davezarzycki
Copy link
Contributor Author

@swift-ci please test

@davezarzycki davezarzycki merged commit ba59ef5 into swiftlang:master Jun 16, 2020
@davezarzycki davezarzycki deleted the pr32345 branch June 16, 2020 12:09
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.

3 participants