Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 51 lines (41 sloc) 1.05 KB
# Create a patch set, save it in patches/patches-<date>-<baseref>
# Points patches/latest to the last created directory, so it's easy to
# git-send-email from there
readonly pre_patchset_hook=.git/hooks/pre-patch-set
readonly post_patchset_hook=.git/hooks/post-patch-set
git rev-list $@ > /dev/null
if [ $? -ne 0 ]; then
echo "Failed to look up refs"
exit 1
# git rev-list will take care of searching for the git-repo
# so if we get here, we know we're inside a git repo.
while ! [ -e ".git" ]; do
cd ..
readonly revs="${@/\//:}"
readonly date=`date +%Y%m%d%H%M`
readonly basedir=patches
readonly dir="patches-$date-$revs"
readonly tmplink="$basedir/latest"
readonly odir="$basedir/$dir"
if [ -e "$odir" ]; then
echo "Directory $dir already exists. Oops."
exit 1
if [ -x "$pre_patchset_hook" ]; then
set -e
set +e
mkdir -p "$odir"
rm -f $tmplink
ln -sf $dir $tmplink
git format-patch -n -o $odir $@
if [ -x "$post_patchset_hook" ]; then
set -e
set +e