git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Price <price@ksplice.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH RFC 4/4] rebase -i: add --refs option to rewrite heads  within branch
Date: Wed, 23 Dec 2009 02:03:03 -0500	[thread overview]
Message-ID: <1ac2d430912222303k6180baa6j291bb4d18c7a4968@mail.gmail.com> (raw)
In-Reply-To: <7vzl5awpf1.fsf@alter.siamese.dyndns.org>

On Tue, Dec 22, 2009 at 6:37 PM, Junio C Hamano <gitster@pobox.com> wrote:
>  - As decoration is a fairly expensive operation (which is the reason why
>   loading_ref_decorations() is called lazily by format_decoration() in
>   the first place, especially in repositories with tons of refs), you
>   shouldn't give --format=%D to rev-list when the new feature is not
>   asked for.

OK, will do.


>  - This seems to rewrite only branch heads; don't you want to allow users
>   to rewrite lightweight tags and possibly annotated ones as well, by
>   perhaps giving "--rewrite-refs=refs/heads/" or "--rewrite-refs=refs/"
>   to limit what parts of the ref namespace to consider rewriting?

Sure.  I specifically left out tags because I generally think of a tag
as something immutable that it would not make sense to rewrite.  But
people use Git in different ways and it makes sense to give the option
of rewriting tags as well as heads.

I do worry that passing --rewrite-refs=refs/ will set up remote refs
for rewriting, which is likely to be confusing if the user does not
notice them and remove them from the TODO.  Perhaps it makes sense to
accept forms like "--rewrite-refs=refs/heads/,refs/tags/" or
"--rewrite-refs=refs/heads/ --rewrite-refs=refs/tags/".  Is there a
Git convention for accepting a sequence of arguments like this to an
option -- one of these, or something else?


> On the other hand, if the "partN" markers in your example workflow are
> primarily meant to be used to mark places on a branch (as opposed to
> arbitrary branch tips that independent development starting from them can
> further continue), it would make a lot more sense to use lightweight or
> annotated tags for them, and instead of "--refs" that rewrites only other
> branch tips, it might make a lot more sense to have "--rewrite-tags" that
> rewrites tags that point at the commits that are rewritten, without
> touching any branch tip.

I think of them as a topic branch developing one feature, then another
branch developing a related follow-on feature, etc.  I would also feel
odd rewriting tags as a routine operation, or calling a ref a tag when
I expect to rewrite it.  So I do think they're best recorded as branch
tips rather than tags.


> Obviously the series also needs tests.

Yes.


> I also have to wonder if this feature should also handle a case like this:
>
>                  side
>                  |
>                  V
>                  *
>                 /
>        part1   *    topic
>          |    /      |
>          v   /       v
>    A--*--*--*--*--*--*
>     \
>      B <--master
>
> ===>
>
>                     side
>                     |
>                     V
>                     *
>                    /
>           part1   *    topic
>     A       |    /      |
>      \      v   /       v
>       B--*--*--*--*--*--*
>       ^ [
>       |
>       master
>
> especially if it were to be specific to branch management.

Huh, that's an interesting idea.  I hadn't thought of that.  This
feature could be nice.  But I am not sure what it would look like.
How might the user indicate that they want both "side" and "topic" to
be rebased?  I suppose we could extend the familiar command line
   git rebase <upstream> [<branch>]
to the form
   git rebase <upstream> [...<branches>...]
so that your example would be
   $ git rebase -i --rewrite-heads master topic side
If we choose this approach, it might even be independent of
--rewrite-refs, though the implementation would presumably rely on the
"ref" command.  Was this interface what you were thinking, or do you
have another idea?

Greg

  reply	other threads:[~2009-12-23  7:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-22 22:20 [PATCH RFC 0/4] rebase -i: Add --refs option to rewrite heads within branch Greg Price
2009-12-22 22:22 ` [PATCH 1/4] pretty: Add %D for script-friendly decoration Greg Price
2009-12-22 22:22 ` [PATCH 2/4] log --decorate=full: drop the "tag: " prefix Greg Price
2009-12-22 22:22 ` [PATCH RFC 3/4] rebase -i: Add the "ref" command Greg Price
2009-12-22 22:23 ` [PATCH RFC 4/4] rebase -i: add --refs option to rewrite heads within branch Greg Price
2009-12-22 23:37   ` Junio C Hamano
2009-12-23  7:03     ` Greg Price [this message]
2009-12-23  8:53       ` Michael J Gruber
2009-12-23 17:34         ` Greg Price
2009-12-23 18:11         ` Junio C Hamano
2009-12-23 13:28       ` 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=1ac2d430912222303k6180baa6j291bb4d18c7a4968@mail.gmail.com \
    --to=price@ksplice.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).