config/git: update existing repos with git-fork

This commit is contained in:
xeruf 2021-10-31 20:21:35 +01:00
parent ad081d7a43
commit 5d6305bf86
3 changed files with 10 additions and 8 deletions

View File

@ -21,7 +21,7 @@ case $command in
git aur push --amend;;
(push)
makepkg --printsrcinfo > .SRCINFO
git add -f .SRCINFO *.install
git add -f .SRCINFO *.install >/dev/null || true
git commit -v -a "$@"
git push;;
esac

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/sh -e
# Clones a fork and sets a corresponding upstream
# ARGS
# - repo name
@ -6,8 +6,10 @@
# - local user
# - url
# - target directory name (and further arguments to clone)
set -e
git-get "${4:-github.com}" "$1" "$3" "${@:5}"
cd $(expr "$5" \| "$1")
if test -d ".git"
then git remote set-url origin "$(git-repo "${4:-github.com}" "$1" "$3" "${@:5}")"
else git-get "${4:-github.com}" "$1" "$3" "${@:5}"
cd $(expr "$5" \| "$1")
fi
test "$2" && git remote add upstream "$(git-repo "${4:-github.com}" "$1" "$2")"
git remote -v

View File

@ -1,7 +1,7 @@
#!/bin/sh
# Translates different repo notations into ssh
case "$1" in
http*) echo "git@$(echo "$1" | cut -d'/' -f3):$(echo "$1" | cut -d'/' -f4)/$(echo "$1" | cut -d'/' -f5)" ;;
git:*) echo "$1" ;;
*) echo "${1:-git.jfischer.org}:${3:-$(git config user.name)}/${2:-$(basename $PWD)}.git" ;;
(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" ;;
esac