Skip to content

Commit 4893ff7

Browse files
committed
fix: support older git versions by not using -C (run in directory) option
1 parent 388276c commit 4893ff7

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

build-scripts/revision-file

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,16 @@ for _dir in $_dirs; do
5858
echo "$(basename "$0"): Debug: Creating revision file in $_dir"
5959

6060
# Get the revision hash
61-
R=$(git -C "$BASEDIR/$_dir" log --abbrev=$CORE_ABBREV --pretty='format:%h' -1 -- .) || false
61+
R=$(cd "$BASEDIR/$_dir"; git log --abbrev=$CORE_ABBREV --pretty='format:%h' -1 -- .) || false
6262

6363
# Make sure there are no hash collisions
64-
if ! git -C "$BASEDIR/$_dir" show "$R" --oneline >/dev/null; then
65-
echo "$(basename "$0"): Error: abbreviated commit hash of $CORE_ABBREV is not unique. Consider increasing the value in the script $0."
66-
exit 1
67-
fi
64+
(
65+
cd "$BASEDIR/$_dir"
66+
if ! git show "$R" --oneline >/dev/null; then
67+
echo "$(basename "$0"): Error: abbreviated commit hash of $CORE_ABBREV is not unique. Consider increasing the value in the script $0"
68+
exit 1
69+
fi
70+
)
6871

6972
# Create the revision file
7073
echo "$R" | tr -d '\n' >"$BASEDIR/$_dir/revision"

0 commit comments

Comments
 (0)