git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 6/7] Add an optional limit to git-formatpatch
@ 2006-01-08  0:40 Yann Dirson
  2006-01-08  9:30 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Yann Dirson @ 2006-01-08  0:40 UTC (permalink / raw)
  To: GIT list

We may not want to format all patches since the merge base.

Signed-off-by: Yann Dirson <ydirson@altern.org>


---

 git-format-patch.sh |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

a0f52fc065de2bdca4f8e598d4a8a743d183d4d9
diff --git a/git-format-patch.sh b/git-format-patch.sh
index 0948f1f..6a0d331 100755
--- a/git-format-patch.sh
+++ b/git-format-patch.sh
@@ -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
-- 
1.0.6-g8ecb

-- 
Yann Dirson    <ydirson@altern.org> |
Debian-related: <dirson@debian.org> |   Support Debian GNU/Linux:
                                    |  Freedom, Power, Stability, Gratis
     http://ydirson.free.fr/        | Check <http://www.debian.org/>

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 6/7] Add an optional limit to git-formatpatch
  2006-01-08  0:40 [PATCH 6/7] Add an optional limit to git-formatpatch Yann Dirson
@ 2006-01-08  9:30 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2006-01-08  9:30 UTC (permalink / raw)
  To: Yann Dirson; +Cc: git

Yann Dirson <ydirson@altern.org> writes:

> 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--*--*--*--upstream

   and 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--*--*--*--upstream

   and 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)?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-01-08  9:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-08  0:40 [PATCH 6/7] Add an optional limit to git-formatpatch Yann Dirson
2006-01-08  9:30 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).