Skip to content

Commit ebe96bc

Browse files
authoredMar 3, 2025
Fix Issue #2050 - loadup script failures if Medley is not a .git directory (#2052)
1 parent 98c481b commit ebe96bc

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed
 

‎scripts/loadup-setup.sh

+17-4
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,27 @@ then
5050
fi
5151
fi
5252

53-
HAS_GIT= [ -f $(which git) ] && [ -x $(which git) ]
53+
HAS_GIT= [ -f $(command -v git) ] && [ -x $(command -v git) ]
5454
export HAS_GIT
5555

56+
is_git_dir () {
57+
if ${HAS_GIT}
58+
then
59+
return $(cd "$1"; git status >/dev/null 2>/dev/null; echo $?)
60+
else
61+
return 1
62+
fi
63+
}
64+
65+
5666
git_commit_ID () {
57-
if ${HAS_GIT};
67+
if ${HAS_GIT}
5868
then
59-
# This does NOT indicate if there are any modified files!
60-
COMMIT_ID=$(git -C "$1" rev-parse --short HEAD)
69+
if is_git_dir "$1"
70+
then
71+
# This does NOT indicate if there are any modified files!
72+
COMMIT_ID=$(git -C "$1" rev-parse --short HEAD)
73+
fi
6174
fi
6275
}
6376

0 commit comments

Comments
 (0)