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 <admwiggin@gmail.com> (github: tianon)
This commit is contained in:
parent
19e01a6363
commit
0a0406450f
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue