[PATCH] Omit patches that have already been merged from format-patch output.
This switches the logic to pick which commits to include in the output from git-rev-list to git-cherry; as a side effect, 'format-patch ^up mine' would stop working although up..mine would continue to work. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Sep 11, 2005 at 11:35 UTC
4a5b63e3e966184aa1ff32770410d485202562ca
1 file changed
+27
-11
git-format-patch.sh
+27
-11
@@ -27,8 +27,6 @@ with applymbox.
27
}
28
29
diff_opts=
30
-IFS='
31
-'
30
LF='
31
'
32
@@ -61,7 +59,10 @@ do
59
--output-directo|--output-director|--output-directory)
60
case "$#" in 1) usage ;; esac; shift
61
outdir="$1" ;;
64
- -*) diff_opts="$diff_opts$LF$1" ;;
62
+ -*' '* | -*"$LF"* | -*' '*)
63
+ # Ignore diff option that has whitespace for now.
64
+ ;;
65
+ -*) diff_opts="$diff_opts$1 " ;;
66
*) break ;;
67
esac
68
shift
@@ -72,16 +73,20 @@ tt)
73
die '--keep-subject and --numbered are incompatible.' ;;
74
esac
75
75
-revpair=
76
+rev1= rev2=
77
case "$#" in
78
2)
78
- revpair="$1..$2" ;;
79
+ rev1="$1" rev2="$2" ;;
80
1)
81
case "$1" in
82
*..*)
82
- revpair="$1";;
83
+ rev1=`expr "$1" : '\(.*\)\.\.'`
84
+ rev2=`expr "$1" : '.*\.\.\(.*\)'`
85
+ ;;
86
*)
84
- revpair="$1..HEAD";;
87
+ rev1="$1"
88
+ rev2="HEAD"
89
+ ;;
90
esac ;;
91
*)
92
usage ;;
@@ -127,10 +132,21 @@ _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
132
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
133
stripCommitHead='/^'"$_x40"' (from '"$_x40"')$/d'
134
130
-git-rev-list --no-merges --merge-order \
131
- $(git-rev-parse --revs-only "$revpair") >$series
135
+git-cherry -v "$rev1" "$rev2" |
136
+while read sign rev comment
137
+do
138
+ case "$sign" in
139
+ '-')
140
+ echo >&2 "Merged already: $comment"
141
+ ;;
142
+ *)
143
+ echo $rev
144
+ ;;
145
+ esac
146
+done >$series
147
+
148
total=`wc -l <$series | tr -dc "[0-9]"`
133
-i=$total
149
+i=1
150
while read commit
151
do
152
git-cat-file commit "$commit" | git-stripspace >$commsg
@@ -145,7 +161,7 @@ do
161
esac
162
163
file=`printf '%04d-%stxt' $i "$title"`
148
- i=`expr "$i" - 1`
164
+ i=`expr "$i" + 1`
165
echo "* $file"
166
{
167
mailScript='