Thread (37 messages) 37 messages, 3 authors, 2024-12-28

Re: [PATCH 2/2] GIT-VERSION-GEN: fix overriding GIT_BUILT_FROM_COMMIT and GIT_DATE

From: Jeff King <hidden>
Date: 2024-12-20 07:37:22

On Thu, Dec 19, 2024 at 04:53:37PM +0100, Patrick Steinhardt wrote:
 GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
-GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
-GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as' 2>/dev/null)
+
+if test -z "$GIT_BUILT_FROM_COMMIT"
+then
+    GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
+fi
+
+if test -z "$GIT_DATE"
+then
+    GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as' 2>/dev/null)
+fi
Looks good. I doubt anybody would want to override BUILT_FROM_COMMIT
(and it was never possible to do so, even before your recent patches),
but it's reasonable to include it as well.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help