From: Oleg Broytman Date: Mon, 9 Dec 2024 16:50:34 +0000 (+0300) Subject: Fix: Add remote `current` or set path if it exists X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;ds=inline;p=cookiecutter.git Fix: Add remote `current` or set path if it exists --- diff --git a/clone2current b/clone2current index 737ccbf..9ec08df 100755 --- a/clone2current +++ b/clone2current @@ -39,4 +39,7 @@ cd "$source_dir" && if [ -n "$directories" ]; then dest_dir="$directories/$dest_dir" fi && -exec git remote add current "$HOME"/current/projects/"$dest_dir" +{ + git remote add current "$HOME"/current/projects/"$dest_dir" || + exec git remote set-url current "$HOME"/current/projects/"$dest_dir" +} diff --git a/publish2web b/publish2web index b0898f1..933227c 100755 --- a/publish2web +++ b/publish2web @@ -52,5 +52,8 @@ cd "$source_dir" && if [ -n "$directories" ]; then dest_dir="$directories/$dest_dir" fi && -git remote add web "$HOME"/Internet/WWW/htdocs/git.phdru.name/"$dest_dir" && +{ + git remote add web "$HOME"/Internet/WWW/htdocs/git.phdru.name/"$dest_dir" || + git remote set-url web "$HOME"/Internet/WWW/htdocs/git.phdru.name/"$dest_dir" +} && exec git push --set-upstream web master