1
0
mirror of synced 2026-01-27 04:41:54 +00:00

Fix Issue #2050 - loadup script failures if Medley is not a .git directory (#2052)

This commit is contained in:
Frank Halasz
2025-03-03 10:27:10 -08:00
committed by GitHub
parent 98c481ba1a
commit ebe96bc7b0

View File

@@ -50,14 +50,27 @@ then
fi
fi
HAS_GIT= [ -f $(which git) ] && [ -x $(which git) ]
HAS_GIT= [ -f $(command -v git) ] && [ -x $(command -v git) ]
export HAS_GIT
git_commit_ID () {
if ${HAS_GIT};
is_git_dir () {
if ${HAS_GIT}
then
# This does NOT indicate if there are any modified files!
COMMIT_ID=$(git -C "$1" rev-parse --short HEAD)
return $(cd "$1"; git status >/dev/null 2>/dev/null; echo $?)
else
return 1
fi
}
git_commit_ID () {
if ${HAS_GIT}
then
if is_git_dir "$1"
then
# This does NOT indicate if there are any modified files!
COMMIT_ID=$(git -C "$1" rev-parse --short HEAD)
fi
fi
}