From 17731ae8fdf47012b5d2efcb8823f94474411315 Mon Sep 17 00:00:00 2001
From: Tom Herbers <mail@tomherbers.de>
Date: Sat, 1 Jan 2022 19:20:41 +0100
Subject: [PATCH] scripts/container.sh: allow for empty Branch Names and git
 errors (#2363)

Resolves #2362
---
 scripts/container.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/container.sh b/scripts/container.sh
index c18bf322..072d2ec1 100755
--- a/scripts/container.sh
+++ b/scripts/container.sh
@@ -6,8 +6,8 @@ set -euo pipefail
 cd "$(dirname "$0")/.."
 
 # normalize branch name to reflect a valid image name
-BRANCH=$(git branch --show-current | sed 's/[^a-z0-9-]/_/ig')
-TAG=gluon:${BRANCH}
+BRANCH=$(git branch --show-current 2>/dev/null | sed 's/[^a-z0-9-]/_/ig')
+TAG="gluon:${BRANCH:-latest}"
 
 if [ "$(command -v podman)" ]
 then
-- 
GitLab