git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* help reproduce fast-forward in rebase
@ 2009-05-20  8:13 Nguyen Thai Ngoc Duy
  2009-05-20  9:26 ` Johannes Sixt
  2009-05-20  9:33 ` Stephan Beyer
  0 siblings, 2 replies; 4+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2009-05-20  8:13 UTC (permalink / raw)
  To: Git Mailing List

Hi,

I'm rewriting rebase in C and do not quite understand this code inside
git-rebase.sh

# If the $onto is a proper descendant of the tip of the branch, then
# we just fast forwarded.
if test "$mb" = "$branch"
then
	echo >&2 "Fast-forwarded $branch_name to $onto_name."
	move_to_original_branch
	exit 0
fi

Anyone has an example how to make "git rebase" execute that code?
-- 
Duy

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

* Re: help reproduce fast-forward in rebase
  2009-05-20  8:13 help reproduce fast-forward in rebase Nguyen Thai Ngoc Duy
@ 2009-05-20  9:26 ` Johannes Sixt
  2009-05-20  9:33 ` Stephan Beyer
  1 sibling, 0 replies; 4+ messages in thread
From: Johannes Sixt @ 2009-05-20  9:26 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: Git Mailing List

Nguyen Thai Ngoc Duy schrieb:
> Hi,
> 
> I'm rewriting rebase in C and do not quite understand this code inside
> git-rebase.sh

One thing that has annoyed me sometimes is that 'git rebase --cont' works
only after 'git rebase -i' but not after plain 'git rebase'. The reason is
that the two instances of rebase do their own argument parsing, and the
interactive version uses rev-parse --parseopt, and normal rebase does not.
I hope you will rectify this situation.

> # If the $onto is a proper descendant of the tip of the branch, then
> # we just fast forwarded.
> if test "$mb" = "$branch"
> then
> 	echo >&2 "Fast-forwarded $branch_name to $onto_name."
> 	move_to_original_branch
> 	exit 0
> fi
> 
> Anyone has an example how to make "git rebase" execute that code?

  $ git checkout -b topic master^
  Switched to a new branch 'topic'
  $ git rebase master
  First, rewinding head to replay your work on top of it...
  Fast-forwarded topic to master.

That is, topic was already merged into master.

-- Hannes

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

* Re: help reproduce fast-forward in rebase
  2009-05-20  8:13 help reproduce fast-forward in rebase Nguyen Thai Ngoc Duy
  2009-05-20  9:26 ` Johannes Sixt
@ 2009-05-20  9:33 ` Stephan Beyer
  2009-05-20  9:37   ` Nguyen Thai Ngoc Duy
  1 sibling, 1 reply; 4+ messages in thread
From: Stephan Beyer @ 2009-05-20  9:33 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: Git Mailing List

Hi Nguyen,

Nguyen Thai Ngoc Duy wrote:
> Hi,
> 
> I'm rewriting rebase in C

Oh. First two remarks that may or may not affect you:

 1. rebase -i -p is reworked by Dscho:

    http://repo.or.cz/w/git/dscho.git?a=shortlog;h=refs/heads/rebase-i-p

 2. sequencer, a C backend for git am and git rebase -i, actually exists

    http://repo.or.cz/w/git/sbeyer.git?a=shortlog;h=refs/heads/seq-builtin-dev

    although to even more lack of time the missing/non-perfect parts are not
    getting fewer.


Both remarks regard "rebase -i" and not the am-based rebase, which means
you are not getting into some kind of conflict with these other developments
(or IOW: you are not doing already done work a second or third time) when you
keep your rebase rewrite close to the original in sh.

> and do not quite understand this code inside git-rebase.sh
> 
> # If the $onto is a proper descendant of the tip of the branch, then
> # we just fast forwarded.
> if test "$mb" = "$branch"
> then
> 	echo >&2 "Fast-forwarded $branch_name to $onto_name."
> 	move_to_original_branch
> 	exit 0
> fi
> 
> Anyone has an example how to make "git rebase" execute that code?

Yes, "if the $onto is a proper descendant of the tip of the branch",
then there are no commits that have to be rewritten. Rebasing can be
done by simple fast-forwarding, i.e. setting the branch to another,
yet existing commit.

Example:

   * onto                 * onto, mybranch
   |                      |
   *                      *
   |                      |
   * mybranch    =>       *
   |                      |
   *                      *
   |                      |


Regards,
  Stephan

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

* Re: help reproduce fast-forward in rebase
  2009-05-20  9:33 ` Stephan Beyer
@ 2009-05-20  9:37   ` Nguyen Thai Ngoc Duy
  0 siblings, 0 replies; 4+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2009-05-20  9:37 UTC (permalink / raw)
  To: Stephan Beyer; +Cc: Git Mailing List

On Wed, May 20, 2009 at 7:33 PM, Stephan Beyer <s-beyer@gmx.net> wrote:
> Hi Nguyen,
>
> Nguyen Thai Ngoc Duy wrote:
>> Hi,
>>
>> I'm rewriting rebase in C
>
> Oh. First two remarks that may or may not affect you:
>
>  1. rebase -i -p is reworked by Dscho:
>
>    http://repo.or.cz/w/git/dscho.git?a=shortlog;h=refs/heads/rebase-i-p
>
>  2. sequencer, a C backend for git am and git rebase -i, actually exists
>
>    http://repo.or.cz/w/git/sbeyer.git?a=shortlog;h=refs/heads/seq-builtin-dev
>
>    although to even more lack of time the missing/non-perfect parts are not
>    getting fewer.

I should have said it clearer: I am rewriting git-rebase.sh in C, not
git-rebase--interactive.sh. The latter is even bigger than former.
Anyway thanks for the pointers.
-- 
Duy

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

end of thread, other threads:[~2009-05-20  9:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-20  8:13 help reproduce fast-forward in rebase Nguyen Thai Ngoc Duy
2009-05-20  9:26 ` Johannes Sixt
2009-05-20  9:33 ` Stephan Beyer
2009-05-20  9:37   ` Nguyen Thai Ngoc Duy

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).