From: Jeff King <peff@peff.net>
To: John Keeping <john@keeping.me.uk>
Cc: Francis Moreau <francis.moro@gmail.com>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Transfer notes when rebasing
Date: Wed, 4 Sep 2013 04:28:03 -0400 [thread overview]
Message-ID: <20130904082803.GA17308@sigill.intra.peff.net> (raw)
In-Reply-To: <20130904075941.GA2582@serenity.lan>
On Wed, Sep 04, 2013 at 08:59:41AM +0100, John Keeping wrote:
> On Wed, Sep 04, 2013 at 03:53:10AM -0400, Jeff King wrote:
> > On Wed, Sep 04, 2013 at 09:51:26AM +0200, Francis Moreau wrote:
> >
> > > When rebasing a branch which contains commits with notes onto another
> > > branch it happens that some commits are already presents in the target
> > > branch.
> > >
> > > In that case git-rebase correctly drops those (already present)
> > > commits but it also drops the notes associated with them.
> > >
> > > Can the notes be transfered somehow in the target branch on the
> > > already present commits ?
> >
> > Yes, see the notes.rewriteRef config option to enable this.
>
> Does that actually work for this case? It sounds like Francis has the
> notes copying correctly when commits are rewritten but the notes are not
> copied anywhere if the commit becomes empty.
Ah, I misunderstood. If we are dropping commits from the rebase because
their counterpart is already applied upstream, then no, there isn't an
automatic way to do this.
If the commits are dropped because a commit with the same patch-id
already exists upstream, you could match them up by patch-id and copy
the notes. Annoyingly, while we have things like "log --cherry-mark" to
show which commits are already present on each side, I do not think
there is a way to correlate them commit for commit. So I think you are
stuck doing something in the shell like:
patch_ids() {
git rev-list "$1" |
git diff-tree --stdin -p |
git patch-id |
sort
}
patch_ids $upstream..HEAD >us
patch_ids HEAD..$upstream >them
join us them |
cut -d' ' -f2-3 |
git notes copy --stdin
However, if the commit is dropped because we find while applying that it
becomes empty, there is not much we can do. It may have been obsoleted
by its counterpart patch that had a different patch-id, or it may even
have been obsoleted by unrelated patches. In the latter case, there is
nothing to copy to. In the former, you would have to trying to match up
the commit messages or similar to guess that the two commits correspond.
-Peff
next prev parent reply other threads:[~2013-09-04 8:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-04 7:51 Transfer notes when rebasing Francis Moreau
2013-09-04 7:53 ` Jeff King
2013-09-04 7:59 ` John Keeping
2013-09-04 8:03 ` Francis Moreau
2013-09-04 8:28 ` Jeff King [this message]
2013-09-04 8:47 ` Francis Moreau
2013-09-04 8:49 ` Jeff King
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=20130904082803.GA17308@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=francis.moro@gmail.com \
--cc=git@vger.kernel.org \
--cc=john@keeping.me.uk \
/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).