zsh:auto,comp: Add git-signoff function

Add `git-signoff` to signoff commits in given range.
Reuse the `_git-rebase` completion function for `git-signoff`.
This commit is contained in:
2022-03-30 02:34:40 +02:00
parent 5caff096cb
commit e024ca9f0a
2 changed files with 22 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
#!/usr/bin/env zsh
## Author: Julian Prein <druckdev@protonmail.com>
## Created: 2022-03-29
##
## Signoff range of commits
# Exit if not in git repo
git rev-parse || return
# Exit if no arguments were given
[[ $# -gt 0 ]] || return
# Signoff all commits
env GIT_SEQUENCE_EDITOR="sed -Ei 's/^p(ick)?/e/'" git rebase -i "$@" || return
while git rebase --show-current-patch &>/dev/null; do
git commit --amend --signoff --no-edit --no-verify
git rebase --continue
done
return 0