From 7389489a55bd1d35277d74092dd0955d08aa7e6e Mon Sep 17 00:00:00 2001 From: Mark Riedesel Date: Sat, 11 Nov 2023 13:04:42 -0600 Subject: [PATCH] add git migration to convert tarball sourced dotfiles into regular git --- bin/dotfiles | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/dotfiles b/bin/dotfiles index c9b20a4..6581a0e 100755 --- a/bin/dotfiles +++ b/bin/dotfiles @@ -3,10 +3,11 @@ # curl https://raw.github.com/Klowner/dotfiles/main/bin/dotfiles | bash basedir="${DOTFILES_ROOT:-$HOME/.dotfiles}" bindir="${DOTFILES_BIN:-$HOME/bin}" +branch="${DOTFILES_BRANCH:-main}" repo="Klowner/dotfiles" gitbase="git://github.com/${repo}.git" gitremote="git@github.com:${repo}" -tarball="http://github.com/${repo}/tarball/master" +tarball="http://github.com/${repo}/tarball/${branch}" function has() { return $(which $1 &> /dev/null) @@ -127,6 +128,12 @@ function git_migrate() { if missing git; then return fi + if [ ! -d "${basedir}/.git" ]; then + note "Migrating dotfiles to git repository..." + git clone $gitremote --no-checkout --branch ${branch} "${basedir}/migrate" + git mv "${basedir}/migrate/.git" "${basedir}/.git" + rm -rf "${basedir}/migrate" + fi } function add() {