Skip to content

Commit 2beb5f9

Browse files
Merge pull request #396 from bharath-b-rh/cm-904
CM-904: Fix clientgen scripts when .git points at a missing submodule gitdir
2 parents 1d9ab3b + 7ecc7a4 commit 2beb5f9

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

hack/update-clientgen.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ set -o pipefail
88
# so all Go commands it runs need module mode
99
export GOFLAGS=""
1010

11-
SCRIPT_ROOT=$(git rev-parse --show-toplevel)
11+
# Prefer git when the work tree is complete (e.g. Konflux copies submodule source without
12+
# the parent repo, so .git may reference a missing gitdir).
13+
SCRIPT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || (cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd))
1214

1315
# code-generator shell scripts aren't vendored (go work vendor only copies .go files)
1416
# so we fetch the module path from the module cache

hack/verify-clientgen.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -o errexit
44
set -o nounset
55
set -o pipefail
66

7-
SCRIPT_ROOT=$(git rev-parse --show-toplevel)
7+
SCRIPT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || (cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd))
88

99
"${SCRIPT_ROOT}/hack/update-clientgen.sh"
1010

0 commit comments

Comments
 (0)