summaryrefslogtreecommitdiff
path: root/git-format-patch.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-09-11 11:35:20 -0700
committerJunio C Hamano <junkio@cox.net>2005-09-12 19:15:02 -0700
commit4a5b63e3e966184aa1ff32770410d485202562ca (patch)
tree64ca471bc45cbc965a72e87c8f2815204d2783b6 /git-format-patch.sh
parent663a5ed5ca964d83269b5616348266bf3b7a7ab4 (diff)
downloadgit-4a5b63e3e966184aa1ff32770410d485202562ca.tar.gz
[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>
Diffstat (limited to 'git-format-patch.sh')
-rwxr-xr-xgit-format-patch.sh38
1 files changed, 27 insertions, 11 deletions
diff --git a/git-format-patch.sh b/git-format-patch.sh
index cfba1deb25..525a2f2212 100755
--- a/git-format-patch.sh
+++ b/git-format-patch.sh
@@ -27,8 +27,6 @@ with applymbox.
}
diff_opts=
-IFS='
-'
LF='
'
@@ -61,7 +59,10 @@ do
--output-directo|--output-director|--output-directory)
case "$#" in 1) usage ;; esac; shift
outdir="$1" ;;
- -*) diff_opts="$diff_opts$LF$1" ;;
+ -*' '* | -*"$LF"* | -*' '*)
+ # Ignore diff option that has whitespace for now.
+ ;;
+ -*) diff_opts="$diff_opts$1 " ;;
*) break ;;
esac
shift
@@ -72,16 +73,20 @@ tt)
die '--keep-subject and --numbered are incompatible.' ;;
esac
-revpair=
+rev1= rev2=
case "$#" in
2)
- revpair="$1..$2" ;;
+ rev1="$1" rev2="$2" ;;
1)
case "$1" in
*..*)
- revpair="$1";;
+ rev1=`expr "$1" : '\(.*\)\.\.'`
+ rev2=`expr "$1" : '.*\.\.\(.*\)'`
+ ;;
*)
- revpair="$1..HEAD";;
+ rev1="$1"
+ rev2="HEAD"
+ ;;
esac ;;
*)
usage ;;
@@ -127,10 +132,21 @@ _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
stripCommitHead='/^'"$_x40"' (from '"$_x40"')$/d'
-git-rev-list --no-merges --merge-order \
- $(git-rev-parse --revs-only "$revpair") >$series
+git-cherry -v "$rev1" "$rev2" |
+while read sign rev comment
+do
+ case "$sign" in
+ '-')
+ echo >&2 "Merged already: $comment"
+ ;;
+ *)
+ echo $rev
+ ;;
+ esac
+done >$series
+
total=`wc -l <$series | tr -dc "[0-9]"`
-i=$total
+i=1
while read commit
do
git-cat-file commit "$commit" | git-stripspace >$commsg
@@ -145,7 +161,7 @@ do
esac
file=`printf '%04d-%stxt' $i "$title"`
- i=`expr "$i" - 1`
+ i=`expr "$i" + 1`
echo "* $file"
{
mailScript='