forked from DizzyEggg/pokeemerald
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: check if inside of git repository before building
- Loading branch information
sbird
committed
Apr 7, 2024
1 parent
41ddd91
commit 2695a7e
Showing
2 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
if [ -e .histignore ] | ||
then | ||
exit 0 | ||
fi | ||
|
||
if [ $GITHUB_ACTION ] | ||
then | ||
exit 0 | ||
fi | ||
|
||
has_hist=false | ||
has_git=1 | ||
if which git >/dev/null | ||
then | ||
has_hist="$(git rev-parse --is-inside-work-tree 2>/dev/null)" | ||
else | ||
has_git=0 | ||
fi | ||
|
||
if [ $has_git -ne 1 ] | ||
then | ||
echo -e "\033[0;31mfatal: \033[0m\033[1;33mgit was not found. You will be unable to use version control, update pokemon_expansion, or use feature branches. To use version control, install \`git\` and clone the repository instead of using \"Download Zip\" on GitHub. Run \`touch .histignore\` to ignore this and continue anyways.\033[0m" | ||
exit 1 | ||
fi | ||
|
||
if [ "$has_hist" ] | ||
then | ||
exit 0 | ||
else | ||
echo -e "\033[0;31mfatal: \033[0m\033[1;33mno git history found. You will be unable to use version control, update pokemon_expansion, or use feature branches. To use version control, use \`git\` to clone the repository instead of using \"Download Zip\" on GitHub. Run \`touch .histignore\` to ignore this and continue anyways.\033[0m" | ||
exit 1 | ||
fi | ||
|