From 65201a3ba8b0866e225a141cf362d8819d8be9d6 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Wed, 17 Nov 2021 15:55:46 +0100 Subject: [PATCH] config/git: improve repo shortcuts --- .local/bin/scripts/git-moves | 3 ++- .local/bin/scripts/git-repo | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.local/bin/scripts/git-moves b/.local/bin/scripts/git-moves index 77130c1..60fcb2f 100755 --- a/.local/bin/scripts/git-moves +++ b/.local/bin/scripts/git-moves @@ -3,6 +3,7 @@ git diff --name-only --cached >/tmp/staged root=$(git rev-parse --show-toplevel) git add "$root" -git status --porcelain --find-renames=.3 | +git status --porcelain --find-renames=.2 | grep -vf /tmp/staged | cut -c4- | sed 's/ -> /\n/' | xargs git -C "$root" restore --staged +git status -s --find-renames=.2 diff --git a/.local/bin/scripts/git-repo b/.local/bin/scripts/git-repo index 1b7b26e..09057b6 100755 --- a/.local/bin/scripts/git-repo +++ b/.local/bin/scripts/git-repo @@ -6,5 +6,11 @@ case "$1" in (http*) echo "$1" | sed "s|.*//\([^/]*\)/\(.*\)|git@\1:\2.git|" ;; (git:*) echo "$1" ;; - (*) echo "${1:-git.jfischer.org}:${3:-$(git config user.name)}/${2:-$(basename $PWD)}.git" ;; + (*) host=$1 + case $1 in + (hub) host=git@github.com;; + (lab) host=git@gitlab.com;; + (*) host=$1;; + esac + echo "${host:-git.jfischer.org}:${3:-$(git config user.name)}/${2:-$(basename $PWD)}.git" ;; esac