Use hash to check git binary

This commit is contained in:
Stefan Zweifel 2022-11-05 11:28:50 +01:00
parent c25d668b43
commit 38a37d1bd4
2 changed files with 8 additions and 3 deletions

View File

@ -45,9 +45,13 @@ _main() {
}
_check_if_git_is_available() {
PATH_TO_GIT=$(which $INPUT_INTERNAL_GIT_BINARY);
echo "::debug::Path to git binary ${PATH_TO_GIT}";
if hash -- "$INPUT_INTERNAL_GIT_BINARY" 2> /dev/null; then
echo "git found";
echo "::debug::git binary found";
else
echo "git not found. git-auto-commit requires git to be available." >&2
exit 1
fi
}
_switch_to_repository() {

View File

@ -1051,4 +1051,5 @@ cat_github_output() {
run git_auto_commit
assert_failure;
assert_line "git not found. git-auto-commit requires git to be available."
}