The git-version script auto-appends the commit id, but complains if the
repository is missing.  The complaint is benign, but we should also tag
builds outside of git with a '+' because who knows what changes were
made locally.

Link: https://github.com/pmem/ndctl/issues/5
Reported-by: Yi Zhang <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
---
 git-version |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/git-version b/git-version
index 3823ee29afaf..9eb8fd654e38 100755
--- a/git-version
+++ b/git-version
@@ -38,9 +38,13 @@ elif test -d ${GIT_DIR:-.git} -o -f .git &&
        VN=$(echo "$VN" | sed -e 's/-/./g');
 else
        read COMMIT COMMIT_SUBJECT <<EOF
-       $(git log --oneline --abbrev=8 -n1 HEAD)
+       $(git log --oneline --abbrev=8 -n1 HEAD 2>/dev/null)
 EOF
-       VN="$(dirty ${DEF_VER}.git$COMMIT)"
+       if [ -z $COMMIT ]; then
+               VN="${DEF_VER}+"
+       else
+               VN="$(dirty ${DEF_VER}.git$COMMIT)"
+       fi
 fi
 
 echo $VN

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to