From 6d67506b9f8b32f8bb817d0dc64b8286a13673a7 Mon Sep 17 00:00:00 2001 From: bretello Date: Sun, 7 Jul 2024 20:27:03 +0200 Subject: [PATCH] zsh: add master->main dotfiles migration --- brethil_dotfile.sh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/brethil_dotfile.sh b/brethil_dotfile.sh index 23d061b..665e303 100755 --- a/brethil_dotfile.sh +++ b/brethil_dotfile.sh @@ -9,15 +9,29 @@ export VIRTUAL_ENV_DISABLE_PROMPT=true export PATH=$PATH:$HOME/bin -if [[ -d "$HOME/.cache/antibody" ]]; then - # antibody migration cleanup - rm -rf $HOME/.cache/antibody -fi +( # main branch migration + set -euo pipefail + cd $DOTFILES + if [[ $(git branch --show-current) == "master" ]]; then + echo "Migrating to main branch..." + git fetch + git stash + git switch main + git stash pop + git branch -D master + echo "Migration done!" + fi +) if [[ ! -d $DOTFILES/antidote ]]; then git clone https://github.com/mattmc3/antidote.git ${DOTFILES}/antidote fi +if [[ -d "$HOME/.cache/antibody" ]]; then + # antibody migration cleanup + rm -rf $HOME/.cache/antibody +fi + export ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/oh-my-zsh" [[ -d $ZSH_CACHE_DIR ]] || mkdir -p $ZSH_CACHE_DIR/completions