Add an optional limit to git-formatpatch
PATCH 6/7 Add an optional limit to git-formatpatch
We may not want to format all patches since the merge base.
---
git-format-patch.sh | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
a0f52fc065de2bdca4f8e598d4a8a743d183d4d9
git-format-patch.sh +7 -1
@@ -30,6 +30,7 @@ diff_opts= LF=' ' +limit= outdir=./ while case "$#" in 0) break;; esac do
@@ -45,6 +46,11 @@ do -k|--k|--ke|--kee|--keep|--keep-|--keep-s|--keep-su|--keep-sub|\ --keep-subj|--keep-subje|--keep-subjec|--keep-subject) keep_subject=t ;; + -l=|--l=|--li=|--lim=|--limi=|--limit=) + limit=`expr "$1" : '-[^=]*=\(.*\)'` ;; + -l|--l|--li|--lim|--limi|--limit) + case "$#" in 1) usage ;; esac; shift + limit="$1" ;; -n|--n|--nu|--num|--numb|--numbe|--number|--numbere|--numbered) numbered=t ;; -s|--s|--si|--sig|--sign|--signo|--signof|--signoff)
@@ -136,7 +142,7 @@ do die "Not a valid rev $rev1 ($revpair)" git-rev-parse --verify "$rev2^0" >/dev/null 2>&1 || die "Not a valid rev $rev2 ($revpair)" - git-cherry -v "$rev1" "$rev2" | + git-cherry -v "$rev1" "$rev2" $limit | while read sign rev comment do case "$sign" in
Signature · 7 lines
1.0.6-g8ecb -- Yann Dirson <[email protected]> | Debian-related: <[email protected]> | Support Debian GNU/Linux: | Freedom, Power, Stability, Gratis http://ydirson.free.fr/ | Check <http://www.debian.org/>
Quoted 1 line · Yann Dirson
We may not want to format all patches since the merge base.
I am unsure about this one for a few reasons.
- If you have:
topic~3--topic~2--topic~1--topic
/
MB--*--*--*--upstreamand you do "not want to format all patches since the merge base", instead of "format-patch --limit=topic~2 master topic", you could just say "format-patch topic~2 topic", so this feature seems unnecessary. Maybe I am not reading you right.
- Even if the idea of having limit makes sense, only one limit can be specified, but you can have multiple (upstream,mine) pairs. Your --limit applies the single limit to all of them. I am not sure if that makes sense either.
I'd expect the limit value to be per (upstream,mine) pair, making "# Now we have what we want in $@" for-loop to iterate over (upstream,mine,limit) 3-tuples.
Internally an (upsteam,mine) pair is canonicalized to be a single string "upstream..mine", so extending the canonical syntax somehow, say, "upstream..mine..limit" where empty "limit" means "use the merge base", might make sense. I dunno.
- One thing that comes to mind is to deal with this structure:
topic~5--topic~4--topic~3--topic~2--topic~1--topic
/ /
Z--*--*--*--*--*--MB--*--*--*--upstreamand you do want to include commits older than topic~3 because they have not been picked up by the upstream. In such a scenario, specifying commit Z as the "limit" may make sense. It is not "limit", but is what ASCII drawing in git-cherry calls "fork-point". Is that what you are doing (the commit log suggests otherwise and you want to get less than what merge base gives you)?