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)
| ... | ... |
@@ -53,9 +53,9 @@ DEFAULT_BUNDLES=( |
| 53 | 53 |
) |
| 54 | 54 |
|
| 55 | 55 |
VERSION=$(cat ./VERSION) |
| 56 |
-if [ -d .git ] && command -v git &> /dev/null; then |
|
| 56 |
+if command -v git &> /dev/null && git rev-parse &> /dev/null; then |
|
| 57 | 57 |
GITCOMMIT=$(git rev-parse --short HEAD) |
| 58 |
- if [ -n "$(git status --porcelain)" ]; then |
|
| 58 |
+ if [ -n "$(git status --porcelain --untracked-files=no)" ]; then |
|
| 59 | 59 |
GITCOMMIT="$GITCOMMIT-dirty" |
| 60 | 60 |
fi |
| 61 | 61 |
elif [ "$DOCKER_GITCOMMIT" ]; then |