From 0a0406450fb83f4ff7d08235cd3e94ea8fba752f Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 10 Feb 2014 13:44:34 -0700 Subject: [PATCH] Add better ".git" detection and use This way, packagers can set GIT_DIR appropriately if they'd prefer to not have ".git" inside their working directory. Docker-DCO-1.1-Signed-off-by: Andrew Page (github: tianon) --- hack/make.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/make.sh b/hack/make.sh index d73b33a4fa..cebb9064e6 100755 --- a/hack/make.sh +++ b/hack/make.sh @@ -53,9 +53,9 @@ DEFAULT_BUNDLES=( ) VERSION=$(cat ./VERSION) -if [ -d .git ] && command -v git &> /dev/null; then +if command -v git &> /dev/null && git rev-parse &> /dev/null; then GITCOMMIT=$(git rev-parse --short HEAD) - if [ -n "$(git status --porcelain)" ]; then + if [ -n "$(git status --porcelain --untracked-files=no)" ]; then GITCOMMIT="$GITCOMMIT-dirty" fi elif [ "$DOCKER_GITCOMMIT" ]; then