瀏覽代碼

Fix detection of git commit during build from tarball

Distro packagers will often use the tarball to build a package and have
the build script for the package in git. To avoid that the docker build
script picks up the git commit from the distro repo we also check for a
directory named .git before check for -unsupported builds.

Signed-off-by: Natanael Copa <natanael.copa@docker.com>
Natanael Copa 9 年之前
父節點
當前提交
355ad33087
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      hack/make.sh

+ 1 - 1
hack/make.sh

@@ -79,7 +79,7 @@ DEFAULT_BUNDLES=(
 )
 )
 
 
 VERSION=$(< ./VERSION)
 VERSION=$(< ./VERSION)
-if command -v git &> /dev/null && git rev-parse &> /dev/null; then
+if command -v git &> /dev/null && [ -d .git ] && git rev-parse &> /dev/null; then
 	GITCOMMIT=$(git rev-parse --short HEAD)
 	GITCOMMIT=$(git rev-parse --short HEAD)
 	if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
 	if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
 		GITCOMMIT="$GITCOMMIT-unsupported"
 		GITCOMMIT="$GITCOMMIT-unsupported"