From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Tom Clarke <tom@u2i.com>
Cc: gitster@pobox.com, git@vger.kernel.org
Subject: Re: [PATCH] Adding rebase merge strategy
Date: Fri, 28 Sep 2007 18:03:50 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0709281751390.28395@racer.site> (raw)
In-Reply-To: <11909961212172-git-send-email-tom@u2i.com>
Hi,
On Fri, 28 Sep 2007, Tom Clarke wrote:
> diff --git a/git-merge-rebase.sh b/git-merge-rebase.sh
> new file mode 100755
> index 0000000..fc07331
> --- /dev/null
> +++ b/git-merge-rebase.sh
> @@ -0,0 +1,34 @@
> +#!/bin/sh
> +#
> +# Copyright (c) 2005 Linus Torvalds
Really?
> +# Copyright (c) 2007 Tom Clarke
> +#
> +# Resolve two trees with rebase
> +
> +# The first parameters up to -- are merge bases; the rest are heads.
> +bases= head= remotes= sep_seen=
> +for arg
> +do
> + case ",$sep_seen,$head,$arg," in
> + *,--,)
> + sep_seen=yes
> + ;;
> + ,yes,,*)
> + head=$arg
> + ;;
> + ,yes,*)
> + remotes="$remotes$arg "
> + ;;
> + *)
> + bases="$bases$arg "
> + ;;
> + esac
> +done
> +
> +# Give up if we are given two or more remotes -- not handling octopus.
> +case "$remotes" in
> +?*' '?*)
> + exit 2 ;;
> +esac
You can check that much earlier, no? IOW something like
while test $# != 0
do
case "$1" in --) break ;; esac
shift
done
test $# = 3 || die "merge stragey rebase needs exactly one ref"
git rebase "$3"
(It's not like you need the variables...) Hmm?
> +git rebase $remotes || exit 2
> diff --git a/git-merge.sh b/git-merge.sh
> index 6c513dc..ea3cc16 100755
> --- a/git-merge.sh
> +++ b/git-merge.sh
> @@ -81,11 +82,18 @@ finish () {
> echo "No merge message -- not updating HEAD"
> ;;
> *)
> - git update-ref -m "$rlogm" HEAD "$1" "$head" || exit 1
> + case " $wt_strategy " in
> + *" $no_update_ref "*)
> + ;;
> + *)
> + git update-ref -m "$rlogm" HEAD "$1" "$head" || exit 1
> + ;;
> + esac
You may want to warn earlier, if a message was supplied with -s rebase, or
even error out.
> diff --git a/t/t3031-merge-rebase.sh b/t/t3031-merge-rebase.sh
> new file mode 100755
> index 0000000..8e3641d
> --- /dev/null
> +++ b/t/t3031-merge-rebase.sh
> @@ -0,0 +1,34 @@
> +#!/bin/sh
> +
> +test_description='merge-rebase backend test'
> +
> +. ./test-lib.sh
> +
> +test_expect_success 'merging using rebase does not create merge commit' '
> + echo hello >a &&
> + git add a &&
> + test_tick && git commit -m initial &&
> +
> + git checkout -b branch &&
> + echo hello >b &&
> + git add b &&
> + test_tick && git commit -m onbranch &&
> +
> + git checkout master &&
> + echo update >a &&
> + git add a &&
> + test_tick && git commit -m update &&
I like to have something like this in a "test_expect_success setup" part,
and then have the meat of the test in its own test case.
But hey, you're the author, it's for you to decide.
Thanks,
Dscho
next prev parent reply other threads:[~2007-09-28 17:05 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-28 16:15 [PATCH] Adding rebase merge strategy Tom Clarke
2007-09-28 17:03 ` Johannes Schindelin [this message]
2007-09-28 17:18 ` Tom Clarke
2007-10-01 15:08 ` Tom Clarke
2007-10-01 15:50 ` Johannes Schindelin
2007-10-01 21:01 ` Junio C Hamano
2007-10-01 21:41 ` Tom Clarke
2007-10-01 22:17 ` Carl Worth
2007-10-01 22:21 ` Tom Clarke
2007-10-01 22:30 ` Shawn O. Pearce
2007-10-01 22:53 ` Carl Worth
2007-10-01 23:11 ` Junio C Hamano
2007-10-02 10:00 ` Johannes Schindelin
2007-10-02 10:29 ` Tom Clarke
2007-10-02 18:40 ` Junio C Hamano
2007-10-03 14:11 ` Tom Clarke
2007-10-03 15:54 ` Johannes Schindelin
2007-10-01 23:09 ` J. Bruce Fields
2007-10-01 22:28 ` Junio C Hamano
[not found] <11885023904126-git-send-email-tom@u2i.com>
2007-08-30 19:36 ` Tom Clarke
2007-08-30 19:53 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0709281751390.28395@racer.site \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=tom@u2i.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).