scatterd-dotfiles/hooks/post-up
Joe Ferris e5c5ff3ebd Use defaultBranch instead of git_template
Git 2.28 now has a setting to change the default branch for new
repositories. This sets init.defaultBranch to main and removes the HEAD
file from the git template.

The HEAD file will need to be removed from ~/.git_template manually, as
rcup does not remove deleted files.

https://github.blog/2020-07-27-highlights-from-git-2-28/#introducing-init-defaultbranch
2020-08-28 17:34:47 -04:00

35 lines
993 B
Bash
Executable file

#!/bin/sh
touch "$HOME"/.psqlrc.local
if [ -e "$HOME"/.vim/autoload/plug.vim ]; then
vim -E -s +PlugUpgrade +qa
else
curl -fLo "$HOME"/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
vim -u "$HOME"/.vimrc.bundles +PlugUpdate +PlugClean! +qa
reset -Q
if [ -f "$HOME/.git_template/HEAD" ] && \
[ "$(cat "$HOME/.git_template/HEAD")" = "ref: refs/heads/main" ]; then
echo "Removing ~/.git_template/HEAD in favor of defaultBranch" >&2
rm -f ~/.git_template/HEAD
fi
# detect old OS X broken /etc/zshenv and suggest rename
if grep -qw path_helper /etc/zshenv 2>/dev/null; then
dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)
cat <<MSG >&2
Warning: \`/etc/zshenv' configuration file on your system may cause unexpected
PATH changes on subsequent invocations of the zsh shell. The solution is to
rename the file to \`zprofile':
sudo mv /etc/{zshenv,zprofile}
(called from ${dir}/post-up:${LINENO})
MSG
fi