* [PATCH 7/7] Add an optional limit to git-rebase
@ 2006-01-08 0:41 Yann Dirson
2006-01-08 2:25 ` Junio C Hamano
2006-01-08 9:30 ` Junio C Hamano
0 siblings, 2 replies; 5+ messages in thread
From: Yann Dirson @ 2006-01-08 0:41 UTC (permalink / raw)
To: GIT list
This patch adds a limit to restrict the list of patches to rebase.
This is useful when a set of patches were done against a given head,
but needs to be ported to a different head, as opposed to being ported
to a descendant of the original head. In such a case we only want to
port our own patches, not those that make the two branches different
upstream.
Signed-off-by: Yann Dirson <ydirson@altern.org>
---
git-rebase.sh | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
bf833136c7c4cc17e7e45b959b56cda11528c33a
diff --git a/git-rebase.sh b/git-rebase.sh
index 16d4359..06c7e1a 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -3,10 +3,10 @@
# Copyright (c) 2005 Junio C Hamano.
#
-USAGE='<upstream> [<head>]'
+USAGE='<upstream> [<head>] [<limit>]'
. git-sh-setup
-case $# in 1|2) ;; *) usage ;; esac
+case $# in 1|2|3) ;; *) usage ;; esac
# Make sure we do not have .dotest
if mkdir .dotest
@@ -36,6 +36,14 @@ other=$(git-rev-parse --verify "$1^0") |
# Make sure the branch to rebase is valid.
head=$(git-rev-parse --verify "${2-HEAD}^0") || exit
+# Set limit
+case "$#" in
+3)
+ limit=$(git-rev-parse --verify "$3^0") || usage ;;
+*)
+ limit= ;;
+esac
+
# If the branch to rebase is given, first switch to it.
case "$#" in
2)
@@ -62,5 +70,5 @@ then
exit 0
fi
-git-format-patch -k --stdout --full-index "$other" ORIG_HEAD |
+git-format-patch -k --stdout --full-index "$other" ORIG_HEAD $limit |
git am --binary -3 -k
--
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] 5+ messages in thread
* Re: [PATCH 7/7] Add an optional limit to git-rebase
2006-01-08 0:41 [PATCH 7/7] Add an optional limit to git-rebase Yann Dirson
@ 2006-01-08 2:25 ` Junio C Hamano
2006-01-08 10:11 ` Yann Dirson
2006-01-08 9:30 ` Junio C Hamano
1 sibling, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2006-01-08 2:25 UTC (permalink / raw)
To: Yann Dirson; +Cc: GIT list
Patches 5, 6, and 7 in the series sound useful, but could they
come with documentation updates please?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 7/7] Add an optional limit to git-rebase
2006-01-08 2:25 ` Junio C Hamano
@ 2006-01-08 10:11 ` Yann Dirson
0 siblings, 0 replies; 5+ messages in thread
From: Yann Dirson @ 2006-01-08 10:11 UTC (permalink / raw)
To: Junio C Hamano; +Cc: GIT list
On Sat, Jan 07, 2006 at 06:25:46PM -0800, Junio C Hamano wrote:
> Patches 5, 6, and 7 in the series sound useful, but could they
> come with documentation updates please?
Right, that sounds reasonable :)
However, since my initial motivation was patch 7, and you correctly
pointed out that 5 and 6 are not needed for 7, I'm not sure what to do
about those 5 and 6. I'll have to let your comments about patch 6
settle in my mind first :)
Best regards,
--
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 [flat|nested] 5+ messages in thread
* Re: [PATCH 7/7] Add an optional limit to git-rebase
2006-01-08 0:41 [PATCH 7/7] Add an optional limit to git-rebase Yann Dirson
2006-01-08 2:25 ` Junio C Hamano
@ 2006-01-08 9:30 ` Junio C Hamano
2006-01-08 10:06 ` Yann Dirson
1 sibling, 1 reply; 5+ 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:
> This patch adds a limit to restrict the list of patches to rebase.
>
> This is useful when a set of patches were done against a given head,
> but needs to be ported to a different head, as opposed to being ported
> to a descendant of the original head. In such a case we only want to
> port our own patches, not those that make the two branches different
> upstream.
This usage makes sense, independent from your git-format-patch
"limit" patch. The patched argument to git-format-patch does
not match your git-format-patch changes AFAICT ;-).
> -git-format-patch -k --stdout --full-index "$other" ORIG_HEAD |
> +git-format-patch -k --stdout --full-index "$other" ORIG_HEAD $limit |
If all you want to do is to move the cut-off point more recent
than the merge base is, how about (without your git-format-patch
changes) doing something stupid like this instead?
git-format-patch -k --stdout --full-index ${limit:-"$other"} ORIG_HEAD
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 7/7] Add an optional limit to git-rebase
2006-01-08 9:30 ` Junio C Hamano
@ 2006-01-08 10:06 ` Yann Dirson
0 siblings, 0 replies; 5+ messages in thread
From: Yann Dirson @ 2006-01-08 10:06 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Sun, Jan 08, 2006 at 01:30:20AM -0800, Junio C Hamano wrote:
> Yann Dirson <ydirson@altern.org> writes:
>
> > This patch adds a limit to restrict the list of patches to rebase.
> >
> > This is useful when a set of patches were done against a given head,
> > but needs to be ported to a different head, as opposed to being ported
> > to a descendant of the original head. In such a case we only want to
> > port our own patches, not those that make the two branches different
> > upstream.
>
> This usage makes sense, independent from your git-format-patch
> "limit" patch. The patched argument to git-format-patch does
> not match your git-format-patch changes AFAICT ;-).
D'oh, I knew I should always written a testsuite when changing the
implementation of a feature at such a late time in night.
> > -git-format-patch -k --stdout --full-index "$other" ORIG_HEAD |
> > +git-format-patch -k --stdout --full-index "$other" ORIG_HEAD $limit |
>
> If all you want to do is to move the cut-off point more recent
> than the merge base is, how about (without your git-format-patch
> changes) doing something stupid like this instead?
>
> git-format-patch -k --stdout --full-index ${limit:-"$other"} ORIG_HEAD
Right, that would even be closer to the version that had indeed been
tested - it does have the advantage of passing t3401, though :)
--
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 [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-01-08 10:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-08 0:41 [PATCH 7/7] Add an optional limit to git-rebase Yann Dirson
2006-01-08 2:25 ` Junio C Hamano
2006-01-08 10:11 ` Yann Dirson
2006-01-08 9:30 ` Junio C Hamano
2006-01-08 10:06 ` Yann Dirson
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).