Recently Written · git

dpatchmail

Patch programs with a dmenu interface

git clone https://github.com/equwal/dpatchmail

Log | Files | Refs


format-patch-clang (904 bytes)

1 #!/bin/sh
2 # takes extra commands to format-patch as arguments
3 [ -z "$1" ] && EMAIL="$(prompt-mail)"
4 [ -n "$1" ] && EMAIL="$1"
5 echo 'clang-format inplace...'
6 y-or-n "Clang format (for C)?" && clang-format -i *.h *.c && echo 'formatted'
7 y-or-n "Stage that?" && git stage *.h *.c
8 y-or-n "Amend it to commit silently?" && git cane
9 echo "Formatting a patch file..."
10 TAG="$(git tag --points-at HEAD^)"
11 TAGDIFF="${PWD##*/}-$(sed 's:.*/::' .git/HEAD)-$(date +%Y%m%d)-$TAG.diff"
12 fp () {
13     file="${PWD##*/}-$(sed 's:.*/::' .git/HEAD)-$1.diff"
14     git format-patch \
15         "$@"
16         --to "$EMAIL" \
17         --stdout HEAD^ \
18     > "$file" \
19     && echo "Wrote $file."
20 }
21 [ -n "$TAG" ] && fp "$TAG"
22 [ -z "$TAG" ] && fp "$(date +%Y%m%d)-$(git rev-parse --short HEAD)"
23 echo "Patch made."
24 y-or-n "git-send-email it right now?" && git-send-email --to "$EMAIL" "$file" \
25 && y-or-n "delete patch file?" && rm "$file"