config/git: adjust git-aur

This commit is contained in:
xeruf 2022-04-12 19:30:12 +02:00
parent 092909e705
commit 2230d3fada
3 changed files with 31 additions and 28 deletions

View File

@ -139,7 +139,7 @@ gitcommits() {
esac esac
done done
local stashed="$(git rev-parse --show-toplevel)/.git/stashed-commits" local stashed="$(git rev-parse --git-path stashed-commits)"
if [ $1 ]; then if [ $1 ]; then
if [ $verbosity -eq 0 ] if [ $verbosity -eq 0 ]
then git rev-list --reverse HEAD...$1 >$stashed then git rev-list --reverse HEAD...$1 >$stashed

View File

@ -4,30 +4,32 @@ test $# -eq 0 && cd "$aurdir" && exec $SHELL
command=$1 command=$1
shift shift
url="ssh://aur@aur.archlinux.org/${1:-$(basename $PWD)}.git" url="ssh://aur@aur.archlinux.org/${1:-$(basename $PWD)}.git"
case $command in case "$command" in
(origin) (origin)
test "$(git rev-parse --git-dir)" = ".git" && git remote set-url origin "$url" test "$(git rev-parse --git-dir)" = ".git" && git remote set-url origin "$url"
git remote -v;; git remote -v;;
(clone) (clone)
cd "$aurdir" cd "$aurdir"
git -c init.defaultBranch=master clone "$url" git -c init.defaultBranch=master clone "$url"
cd "$1" cd "$1"
test -f PKGBUILD || sed "s/PKG/${1%%-git}/" ../PKGBUILD > PKGBUILD test -f PKGBUILD || sed "s/PKG/${1%%-git}/" ../PKGBUILD > PKGBUILD
test -f .gitignore || echo '*' > .gitignore test -f .gitignore || echo '*' > .gitignore
exec $SHELL;; exec $SHELL;;
(create) (create)
git add -f .gitignore PKGBUILD git add -f .gitignore PKGBUILD
git commit -m "Create package" "$@" git commit -m "Create package" "$@"
git aur push --amend;; git aur push --amend;;
(push) (commit)
updpkgsums makepkg --printsrcinfo > .SRCINFO
makepkg --printsrcinfo > .SRCINFO git add -f .SRCINFO
git add -f .SRCINFO *.install 2>/dev/null || true git commit -v "$@"
git commit -v -a "$@" (push)
git push;; updpkgsums
(clean) git add -f *.install 2>/dev/null || true
find "$aurdir" -mindepth 2 -maxdepth 2 \( -name "*.tar.gz" -o -type d -not -name ".*" \) \ git aur commit -a "$@"
-print -exec sudo rm -rI {} +;; git push;;
(*) echo "Unknown command!"; exit 3;; (clean)
find "$aurdir" -mindepth 2 -maxdepth 2 \( -iname "*.pkg.tar.*" -o -type d -not -name ".*" \) \
-print -exec sudo rm -rI {} +;;
(*) echo "Unknown command!"; exit 3;;
esac esac

View File

@ -3,12 +3,13 @@
# If the first arg is "add", files are staged rather than committed. # If the first arg is "add", files are staged rather than committed.
# All remaining args are passed to git-commit # All remaining args are passed to git-commit
# TODO fix broken prep-commit-msg hook when there is no unifying path # TODO fix broken prep-commit-msg hook when there is no unifying path
# fix broken alt-enter not opening editor --bind='alt-enter:change-prompt(hi>)'
fzfpipe() { fzfpipe() {
# Take nul-separated input from git-status short/porcelain # Take nul-separated input from git-status short/porcelain
# and return a newline-separated list of selected files # and return a newline-separated list of selected files
cut -z -c2- | cut -z -c2- |
git fzf-diff --read0 -d' ' --nth=2.. --bind='alt-enter:execute(nvim {2..})' \ git fzf-diff --read0 -d' ' --nth=2.. --bind="alt-enter:execute($EDITOR '$(git rev-parse --show-toplevel)/{2..}')" \
--preview="test {1} != \? && git diff --color HEAD -U5 -- {2..} | $(git config interactive.diffFilter) || find {2..} -type f | xargs -I% diff --recursive --color=always -u /dev/null %" | --preview="test {1} != \? && git diff --color HEAD -U5 -- {2..} | $(git config interactive.diffFilter) || find {2..} -type f | xargs -I% diff --recursive --color=always -u /dev/null %" |
cut -c3- cut -c3-
} }