From 2230d3fada01af62241d1ed27810de1ae016f4bd Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Tue, 12 Apr 2022 19:30:12 +0200 Subject: [PATCH] config/git: adjust git-aur --- .config/shell/git | 2 +- .local/bin/scripts/git-aur | 54 +++++++++++++++++++------------------ .local/bin/scripts/git-fuzz | 3 ++- 3 files changed, 31 insertions(+), 28 deletions(-) diff --git a/.config/shell/git b/.config/shell/git index 9695b71..f3f754a 100644 --- a/.config/shell/git +++ b/.config/shell/git @@ -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 diff --git a/.local/bin/scripts/git-aur b/.local/bin/scripts/git-aur index 2e89466..ddd8948 100755 --- a/.local/bin/scripts/git-aur +++ b/.local/bin/scripts/git-aur @@ -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 - diff --git a/.local/bin/scripts/git-fuzz b/.local/bin/scripts/git-fuzz index 4a431eb..0a31c65 100755 --- a/.local/bin/scripts/git-fuzz +++ b/.local/bin/scripts/git-fuzz @@ -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- }