|
|
|
@ -13,11 +13,14 @@ export PAGER='less --mouse' |
|
|
|
|
export BROWSER='firefox -P Mari --class Firefox.Main' |
|
|
|
|
# Set up the vim config path |
|
|
|
|
export VIM_CONFIG_DIR=$__COMMON_CONFIGS/vim |
|
|
|
|
# Set the SSH auth sock to the central location |
|
|
|
|
if [[ -n $SSH_AUTH_SOCK ]] && [[ $SSH_AUTH_SOCK != $HOME/.ssh/ssh_auth_sock ]]; then |
|
|
|
|
# Run an SSH agent if one doesn't already exist and link the (new or existing) SSH auth socket to the central location |
|
|
|
|
if [[ ! -S $HOME/.ssh/ssh_auth_sock ]] && [[ ! -S $SSH_AUTH_SOCK ]] ; then |
|
|
|
|
eval $(ssh-agent -s | head -n1) |
|
|
|
|
fi |
|
|
|
|
if [[ -S $SSH_AUTH_SOCK ]] && [[ $SSH_AUTH_SOCK != $HOME/.ssh/ssh_auth_sock ]]; then |
|
|
|
|
ln -sf "$SSH_AUTH_SOCK" "$HOME/.ssh/ssh_auth_sock" |
|
|
|
|
fi |
|
|
|
|
export SSH_AUTH_SOCK="$HOME/.ssh/ssh_auth_sock" |
|
|
|
|
SSH_AUTH_SOCK="$HOME/.ssh/ssh_auth_sock"; export SSH_AUTH_SOCK |
|
|
|
|
|
|
|
|
|
# Set potentially-destructive commands to use interactive modes |
|
|
|
|
alias rm='rm -i' |
|
|
|
@ -40,14 +43,14 @@ function __common_configs_in_sync() { |
|
|
|
|
# Failure modes, in order: |
|
|
|
|
# exit 9: Problem cd'ing or getting commit hashes - things that should never fail |
|
|
|
|
cd $__COMMON_CONFIGS || exit 9 |
|
|
|
|
localCommit=$(git show-ref --verify --hash refs/heads/master) || exit 9 |
|
|
|
|
localCommit=$(git show-ref --verify --hash refs/heads/main) || exit 9 |
|
|
|
|
if [[ $1 == --force-fetch ]] || [[ ! -f .last-fetch ]] || [[ $(date --reference=.last-fetch +%s) -lt $(date --date='5 minutes ago' +%s) ]]; then |
|
|
|
|
git fetch --quiet origin && touch .last-fetch |
|
|
|
|
fi |
|
|
|
|
remoteCommit=$(git show-ref --verify --hash refs/remotes/origin/master) || exit 9 |
|
|
|
|
# exit 1: master is not the commit which is checked out. |
|
|
|
|
[[ $(git symbolic-ref HEAD) == "refs/heads/master" ]] || exit 1 |
|
|
|
|
# exit 2: master and origin/master are different. |
|
|
|
|
remoteCommit=$(git show-ref --verify --hash refs/remotes/origin/main) || exit 9 |
|
|
|
|
# exit 1: main is not the commit which is checked out. |
|
|
|
|
[[ $(git symbolic-ref HEAD) == "refs/heads/main" ]] || exit 1 |
|
|
|
|
# exit 2: main and origin/main are different. |
|
|
|
|
[[ $localCommit == $remoteCommit ]] || exit 2 |
|
|
|
|
# exit 3: There are staged changes. |
|
|
|
|
git diff-index --cached --exit-code --quiet HEAD || exit 3 |
|
|
|
|