Recently Written · git

dpatchmail

Patch programs with a dmenu interface

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

Log | Files | Refs


format-patch (689 bytes)

1 #!/bin/sh
2 # also see suckless-format-patch and friends
3 [ -z "$1" ] && EMAIL="$(prompt-mail)"
4 [ -n "$1" ] && EMAIL="$1"
5 echo "Formatting a patch file..."
6 TAG="$(git tag --points-at HEAD^)"
7 TAGDIFF="${PWD##*/}-$(sed 's:.*/::' .git/HEAD)-$(date +%Y%m%d)-$TAG.diff"
8 fp () {
9     file="${PWD##*/}-$(sed 's:.*/::' .git/HEAD)-$1.diff"
10     git format-patch \
11         --to "$EMAIL" \
12         --stdout HEAD^ \
13         > "$file" \
14     && echo "Wrote $file."
15 }
16 [ -n "$TAG" ] && fp "$TAG"
17 [ -z "$TAG" ] && fp "$(date +%Y%m%d)-$(git rev-parse --short HEAD)"
18 echo "Patch made."
19 y-or-n "git-send-email it right now?" && git-send-email --to "$EMAIL" "$file" \
20   && y-or-n "delete patch file?" && rm "$file"