aboutsummaryrefslogtreecommitdiff
path: root/share/genbuild.sh
diff options
context:
space:
mode:
Diffstat (limited to 'share/genbuild.sh')
-rwxr-xr-xshare/genbuild.sh11
1 files changed, 8 insertions, 3 deletions
diff --git a/share/genbuild.sh b/share/genbuild.sh
index eecac4bd00..cd6214d5fa 100755
--- a/share/genbuild.sh
+++ b/share/genbuild.sh
@@ -3,8 +3,9 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
+export LC_ALL=C
if [ $# -gt 1 ]; then
- cd "$2"
+ cd "$2" || exit 1
fi
if [ $# -gt 0 ]; then
FILE="$1"
@@ -17,11 +18,15 @@ else
exit 1
fi
+git_check_in_repo() {
+ ! { git status --porcelain -uall --ignored "$@" 2>/dev/null || echo '??'; } | grep -q '?'
+}
+
DESC=""
SUFFIX=""
-if [ -e "$(which git 2>/dev/null)" -a "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]; then
+if [ "${BITCOIN_GENBUILD_NO_GIT}" != "1" ] && [ -e "$(command -v git)" ] && [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ] && git_check_in_repo share/genbuild.sh; then
# clean 'dirty' status of touched files that haven't been modified
- git diff >/dev/null 2>/dev/null
+ git diff >/dev/null 2>/dev/null
# if latest commit is tagged and not dirty, then override using the tag name
RAWDESC=$(git describe --abbrev=0 2>/dev/null)