macOS fixes

This commit is contained in:
Jay Oster 2018-12-16 15:30:27 -08:00
parent e32e97c925
commit a533d98e23
2 changed files with 16 additions and 8 deletions

View File

@ -3,6 +3,10 @@
# #
# commit-db.rb list-valid nightly|GIT_DIR=/your/rust/dir/.git ./build-src.sh # commit-db.rb list-valid nightly|GIT_DIR=/your/rust/dir/.git ./build-src.sh
if [ $(uname) == 'Darwin' ]; then
alias tac='tail -f'
fi
prompt_changes() { prompt_changes() {
local MAIN_GIT_DIR="$GIT_DIR" local MAIN_GIT_DIR="$GIT_DIR"
local GIT_DIR=./.git CORE_IO_COMMIT=$IO_COMMIT local GIT_DIR=./.git CORE_IO_COMMIT=$IO_COMMIT
@ -17,9 +21,9 @@ prompt_changes() {
GIT_DIR="$MAIN_GIT_DIR" git_commits_ordered '%H %cd' $(get_patch_commits) $IO_COMMIT | \ GIT_DIR="$MAIN_GIT_DIR" git_commits_ordered '%H %cd' $(get_patch_commits) $IO_COMMIT | \
grep --color=always -1 $IO_COMMIT | sed /$IO_COMMIT/'s/$/ <=== your commit/' grep --color=always -1 $IO_COMMIT | sed /$IO_COMMIT/'s/$/ <=== your commit/'
echo echo
bold_arrow; echo -e "Try applying one of those using: \e[1;36mtry_patch COMMIT\e[0m" bold_arrow; echo -e "Try applying one of those using: \033[1;36mtry_patch COMMIT\033[0m"
bold_arrow; echo -e "Remember to test your changes with: \e[1;36mcargo build\e[0m" bold_arrow; echo -e "Remember to test your changes with: \033[1;36mcargo build\033[0m"
bold_arrow; echo -e "Make your changes now (\e[1;36mctrl-D\e[0m when finished)" bold_arrow; echo -e "Make your changes now (\033[1;36mctrl-D\033[0m when finished)"
bash_diff_loop "No changes were made" bash_diff_loop "No changes were made"
bold_arrow; echo "Saving changes as $IO_COMMIT.patch" bold_arrow; echo "Saving changes as $IO_COMMIT.patch"
git clean -f -x git clean -f -x
@ -64,7 +68,11 @@ for IO_COMMIT in $OLD_COMMITS $(git_commits_ordered %H $NEW_COMMITS|tac); do
fi fi
done done
OLD_GIT_PERM=$(stat --printf=%a .git) if [ $(uname) == 'Darwin' ]; then
OLD_GIT_PERM=$(stat -f %Op .git)
else
OLD_GIT_PERM=$(stat --printf=%a .git)
fi
trap "chmod $OLD_GIT_PERM .git; exit 1" SIGINT trap "chmod $OLD_GIT_PERM .git; exit 1" SIGINT
chmod 000 .git chmod 000 .git
cargo ${1:-package} cargo ${1:-package}

View File

@ -35,7 +35,7 @@ get_io_commits() {
} }
get_patch_commits() { get_patch_commits() {
find $PATCH_DIR -type f -printf %f\\n|cut -d. -f1 find $PATCH_DIR -type f|xargs -n 1 basename|cut -d. -f1
} }
prepare_version() { prepare_version() {
@ -54,7 +54,7 @@ prepare_version() {
} }
bold_arrow() { bold_arrow() {
echo -ne '\e[1;36m==> \e[0m' echo -ne '\033[1;36m==> \033[0m'
} }
custom_bashrc() { custom_bashrc() {