Re: I want to release a "git-1.0"
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:41:59
On a related topic of making bare Plumbing a bit easier to use,
here is what I use to prepare patches, one patch per file, to be
sent to Linus via e-mail.
Usage:
$ git-format-patch-script HEAD linus
Assuming that "linus" is the tip of the tree from Linus
(typically stored in .git/branches/linus if you use Cogito), and
HEAD is your additions on top of it, the above command will
produce patches in the format you have been seeing on this list
from me, one file per commit, in .patches/XXXX-patch-title.txt
file.
Signed-off-by: Junio C Hamano <redacted>
---
sed -e 's/^X//' >git-format-patch-script <<\EOF
X#!/bin/sh
X#
X# Copyright (c) 2005 Junio C Hamano
X#
Xjunio="$1"
Xlinus="$2"
X
Xtmp=.tmp-series$$
Xtrap 'rm -f $tmp-*' 0 1 2 3 15
X
Xseries=$tmp-series
X
XtitleScript='
X 1,/^$/d
X : loop
X /^$/b loop
X s/[^-a-z.A-Z_0-9]/-/g
X s/^--*//g
X s/--*$//g
X s/---*/-/g
X s/$/.txt/
X s/\.\.\.*/\./g
X q
X'
XO=
Xif test -f .git/patch-order
Xthen
X O=-O.git/patch-order
Xfi
Xgit-rev-list "$junio" "$linus" >$series
Xtotal=`wc -l <$series`
Xi=$total
Xwhile read commit
Xdo
X title=`git-cat-file commit "$commit" | sed -e "$titleScript"`
X num=`printf "%d/%d" $i $total`
X file=`printf '%04d-%s' $i "$title"`
X i=`expr "$i" - 1`
X echo "$file"
X {
X mailScript='
X 1,/^$/d
X : loop
X /^$/b loop
X s|^|[PATCH '"$num"'] |
X : body
X p
X n
X b body'
X
X git-cat-file commit "$commit" | sed -ne "$mailScript"
X echo '---'
X git-diff-tree -p $O "$commit" | diffstat -p1
X echo
X git-diff-tree -p $O "$commit"
X } >".patches/$file"
Xdone <$series
EOF