Git fork

GIT-VERSION-GEN: fix overriding GIT_BUILT_FROM_COMMIT and GIT_DATE

Same as with the preceding commit, neither GIT_BUILT_FROM_COMMIT nor
GIT_DATE can be overridden via the environment. Especially the latter is
of importance given that we set it in our own "Documentation/doc-diff"
script.

Make the values of both variables overridable. Luckily we don't pull in
these values via any included Makefiles, so the fix is trivial compared
to the fix for GIT_VERSON.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
cfa01e6d 992bc561

+12 -2
+10 -2
GIT-VERSION-GEN
··· 56 56 GIT_VERSION=$(expr "$VN" : v*'\(.*\)') 57 57 fi 58 58 59 - GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null) 60 - GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as' 2>/dev/null) 59 + if test -z "$GIT_BUILT_FROM_COMMIT" 60 + then 61 + GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null) 62 + fi 63 + 64 + if test -z "$GIT_DATE" 65 + then 66 + GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as' 2>/dev/null) 67 + fi 68 + 61 69 if test -z "$GIT_USER_AGENT" 62 70 then 63 71 GIT_USER_AGENT="git/$GIT_VERSION"
+2
shared.mak
··· 121 121 # absolute path to the root source directory as well as input and output files 122 122 # as arguments, in that order. 123 123 define version_gen 124 + GIT_BUILT_FROM_COMMIT="$(GIT_BUILT_FROM_COMMIT)" \ 125 + GIT_DATE="$(GIT_DATE)" \ 124 126 GIT_USER_AGENT="$(GIT_USER_AGENT)" \ 125 127 GIT_VERSION="$(GIT_VERSION_OVERRIDE)" \ 126 128 $(SHELL_PATH) "$(1)/GIT-VERSION-GEN" "$(1)" "$(2)" "$(3)"