Skip to content

Commit 333f2d0

Browse files
pks-tgitster
authored andcommitted
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. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent eace4b0 commit 333f2d0

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

GIT-VERSION-GEN

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,18 @@ then
5353
else
5454
VN="$DEF_VER"
5555
fi
56-
5756
GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
58-
GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
59-
GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as' 2>/dev/null)
57+
58+
if test -z "$GIT_BUILT_FROM_COMMIT"
59+
then
60+
GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
61+
fi
62+
63+
if test -z "$GIT_DATE"
64+
then
65+
GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as' 2>/dev/null)
66+
fi
67+
6068
if test -z "$GIT_USER_AGENT"
6169
then
6270
GIT_USER_AGENT="git/$GIT_VERSION"

0 commit comments

Comments
 (0)