With recent git releases, the .git at the top of a repo is not necessary a directory but can be a gitfile pointing to a remote git directory. This is commonly used by git-worktree and git-submodule. This patch changes the check for .git to allow for any file (symlinks too)
Signed-off-by: Nicolas Morey-Chaisemartin <nmo...@kalray.eu> --- scripts/git_hash.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/git_hash.sh b/scripts/git_hash.sh index ccd62ab..e7f43f2 100755 --- a/scripts/git_hash.sh +++ b/scripts/git_hash.sh @@ -6,7 +6,7 @@ if [ -z ${1} ]; then fi ROOTDIR=${1} -if [ -d ${ROOTDIR}/.git ]; then +if [ -e ${ROOTDIR}/.git ]; then hash=$(git --git-dir=${ROOTDIR}/.git describe | tr -d "\n") if [[ $(git --git-dir=${ROOTDIR}/.git diff --shortstat 2> /dev/null \ | tail -n1) != "" ]]; then @@ -18,7 +18,7 @@ if [ -d ${ROOTDIR}/.git ]; then sed -i "s|-|.git|" ${ROOTDIR}/.scmversion sed -i "s|-|.|g" ${ROOTDIR}/.scmversion sed -i "s|^v||g" ${ROOTDIR}/.scmversion -elif [ ! -d ${ROOTDIR}/.git -a ! -f ${ROOTDIR}/.scmversion ]; then +elif [ ! -e ${ROOTDIR}/.git -a ! -f ${ROOTDIR}/.scmversion ]; then echo -n "File ROOTDIR/.scmversion not found, " echo "and not inside a git repository" echo "Bailing out! Not recoverable!" _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp