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
done
local stashed="$(git rev-parse --show-toplevel)/.git/stashed-commits"
local stashed="$(git rev-parse --git-path stashed-commits)"
if [ $1 ]; then
if [ $verbosity -eq 0 ]
then git rev-list --reverse HEAD...$1 >$stashed

View File

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

View File

@ -3,12 +3,13 @@
# If the first arg is "add", files are staged rather than committed.
# All remaining args are passed to git-commit
# 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() {
# Take nul-separated input from git-status short/porcelain
# and return a newline-separated list of selected files
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 %" |
cut -c3-
}