about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-10-09 09:31:36 -0700
committerbors <bors@rust-lang.org>2013-10-09 09:31:36 -0700
commit4fd7f852e131ad8c9935fd9577c071be5b4635ec (patch)
tree0730814816af37bd227182647b2932356a13affe
parent2e64a718ea7db51f79a46441907bf659cb761e9c (diff)
parent6434d0b58f094497075fe58c1ed257a2077f02ce (diff)
downloadrust-4fd7f852e131ad8c9935fd9577c071be5b4635ec.tar.gz
rust-4fd7f852e131ad8c9935fd9577c071be5b4635ec.zip
auto merge of #9748 : klutzy/rust/print-git-revision, r=alexcrichton
Fixes a bug that `rustc.exe -v` didn't show git revision hash.
The bug is caused by that `$(wildcard $(CFG_GIT))` requires
space-escaped inputs while `$(CFG_GIT)` is usually
`C:\Program Files (x86)\Gitin\git.exe`.
-rw-r--r--Makefile.in14
1 files changed, 10 insertions, 4 deletions
diff --git a/Makefile.in b/Makefile.in
index 06adc311f78..5eaeb84d727 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -147,11 +147,17 @@ CFG_VERSION = $(CFG_RELEASE)
 # numbers and dots here
 CFG_VERSION_WIN = 0.9
 
-ifneq ($(wildcard $(CFG_GIT)),)
-ifneq ($(wildcard $(CFG_GIT_DIR)),)
-    CFG_VERSION += $(shell git --git-dir=$(CFG_GIT_DIR) log -1 \
+# since $(CFG_GIT) may contain spaces (especially on Windows),
+# we need to escape them. (" " to r"\ ")
+# Note that $(subst ...) ignores space after `subst`,
+# so we use a hack: define $(SPACE) which contains space character.
+SPACE :=
+SPACE +=
+ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT))),)
+ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT_DIR))),)
+    CFG_VERSION += $(shell git --git-dir='$(CFG_GIT_DIR)' log -1 \
                      --pretty=format:'(%h %ci)')
-    CFG_VER_HASH = $(shell git --git-dir=$(CFG_GIT_DIR) rev-parse HEAD)
+    CFG_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse HEAD)
 endif
 endif