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

rustc: Print a smaller hash on -v #15766

Closed
wants to merge 1 commit into from

Conversation

alexcrichton
Copy link
Member

The long hash just takes up space and you can discover the main hash through the
rustc --version verbose command.

@@ -46,7 +46,8 @@ ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT))),)
ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT_DIR))),)
CFG_VER_DATE = $(shell git --git-dir='$(CFG_GIT_DIR)' log -1 --pretty=format:'%ci')
CFG_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse HEAD)
CFG_VERSION += ($(CFG_VER_HASH) $(CFG_VER_DATE))
CFG_SHORT_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse --short HEAD)
Copy link
Contributor

Choose a reason for hiding this comment

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

You should pass a length to --short, otherwise it will use the core.abbrev configuration value. The classic value is 7, but our repo already has a few commits that require 8 and one that requires 9 to be unique (at least, within my clone of the repo). I would therefore recommend going with 9, because it would be preferable for everyone to use the same hashes for the same commits).

+    CFG_SHORT_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse --short=9 HEAD)

@lilyball
Copy link
Contributor

r=me with --short=9.

@lilyball
Copy link
Contributor

Actually, you could probably tweak mk/docs.mk to use CFG_SHORT_VER_HASH on line 116 instead of what it currently does, which is truncate CFG_VER_HASH to 8 bytes.

The long hash just takes up space and you can discover the main hash through the
`rustc --version verbose` command.
@alexcrichton alexcrichton deleted the smaller-rev branch July 22, 2014 05:11
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