git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Herland <johan@herland.net>
To: git@vger.kernel.org
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Jeff King <peff@peff.net>,
	Govind Salinas <govind@sophiasuchtig.com>
Subject: Re: rebasing commits that have notes, was Re: Git Notes idea.
Date: Wed, 17 Dec 2008 10:15:45 +0100	[thread overview]
Message-ID: <200812171015.45303.johan@herland.net> (raw)
In-Reply-To: <alpine.DEB.1.00.0812170110160.14632@racer>

On Wednesday 17 December 2008, Johannes Schindelin wrote:
> Hi,
>
> On Tue, 16 Dec 2008, Jeff King wrote:
> >   Some discussion of the interaction of notes and rebase:
> >   http://thread.gmane.org/gmane.comp.version-control.git/100533
>
> Oh, I misinterpreted that label... of course you can track rebases in
> notes, but some issue that we did not look into yet (I think) is the
> issue that you can cherry-pick and rebase commits and lose notes in the
> process.
>
> It seems that the notes idea is not that unintrusive as I thought...

So we have two issues here:

1. Using notes to annotate the rebase/cherry-pick action itself.

2. Preserving (or at least giving the user the option of preserving) notes 
across a rebase/cherry-pick.


I think issue #1 has already been discussed, and is largely resolved: People 
can do this if they want to; it probably only makes sense when 
rebasing/cherry-picking public branches; etc... AFAICS there are no 
remaining problems here that needs an intrusive solution (see below for one 
such unintrusive alternative).

Issue #2, however, is a little more involved. We can discuss the merits of 
wanting to preserve notes across a rebase/cherry-pick itself; e.g. when it 
makes sense to preserve notes, and when it doesn't make sense, but I think 
this is orthogonal to the issue of HOW to preserve them, so instead of 
focusing on WHY, I'll focus on HOW:

If notes are named according to the "refs/notes:<first byte in hex>/<rest of 
bytes>/<referenced object SHA-1>" scheme (and AFAICS this is still being 
discussed, so it's indeed a big IF), then rebase/cherry-pick of the 
referenced object simply translates to a rename/copy of the corresponding 
note (this is of course assuming that the note itself does not contain the 
SHA-1 of the referenced object). This could probably be solved fairly 
unintrusively in the current code, but there are (as always) complications:

- The user may want to amend the note after the rebase/cherry-pick (just as 
(s)he may want to amend the commit message).

- In some cases it may even make sense to fold (parts of) the note _into_ 
the commit message.

- probably more reasons...

So what about the following proposal: Add hooks that are invoked by 
rebase/cherry-pick with the <from-SHA1> and <to-SHA1> as arguments. A 
typical hook script can then use this information to look up notes 
referencing <from-SHA1> and update these to reference <to-SHA1> instead, 
and in the process, prompt the user to do whatever changes (s)he wants to. 
The hook scripts can do other things as well, e.g. implementing issue #1 
above (adding notes for annotating the rebase/cherry-pick itself.)


Have fun! :)

...Johan


PS: What's the current status on git-sequencer? It's probably the best place 
to invoke these hooks.

-- 
Johan Herland, <johan@herland.net>
www.herland.net

  reply	other threads:[~2008-12-17  9:20 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-16  8:15 Git Notes idea Govind Salinas
2008-12-16  8:51 ` Jeff King
2008-12-16  8:53   ` Jeff King
2008-12-16 18:43   ` Govind Salinas
2008-12-16 23:48     ` Johannes Schindelin
2008-12-17  9:45       ` Jeff King
     [not found]       ` <5d46db230812161815s1c48af9dwc96a4701fb2a669b@mail.gmail.com>
     [not found]         ` <alpine.DEB.1.00.0812170420560.14632@racer>
2008-12-17 10:11           ` Jeff King
2008-12-17 11:38             ` Johannes Schindelin
2008-12-17 19:20               ` Junio C Hamano
2008-12-18  3:08                 ` Johannes Schindelin
2008-12-19 17:42               ` Govind Salinas
2008-12-19 17:18             ` Govind Salinas
2008-12-19 17:38               ` Govind Salinas
2008-12-19 21:25                 ` Jeff King
2008-12-19 22:24                   ` Govind Salinas
2008-12-20  4:54                     ` Jeff King
2008-12-17 12:21       ` Petr Baudis
2008-12-17  9:38     ` Jeff King
2008-12-17 17:06       ` Govind Salinas
2008-12-18 13:54         ` Jeff King
2008-12-17  0:12   ` rebasing commits that have notes, was " Johannes Schindelin
2008-12-17  9:15     ` Johan Herland [this message]
2008-12-17 17:55       ` Stephan Beyer
2008-12-19 23:34   ` [PATCH 0/4] Notes reloaded Johannes Schindelin
2008-12-19 23:35     ` [PATCH 1/4] Introduce commit notes Johannes Schindelin
2008-12-20  6:53       ` Jeff King
2008-12-20  7:55         ` Robin Rosenberg
2008-12-20  8:05           ` Jeff King
2008-12-20  8:17             ` Junio C Hamano
2008-12-20  8:23               ` Jeff King
2008-12-20 20:09                 ` Junio C Hamano
2008-12-20 12:04         ` [PATCH v2 0/4] Notes, reloaded Johannes Schindelin
2008-12-20 12:05           ` [PATCH v2 1/4] Introduce commit notes Johannes Schindelin
2008-12-20 12:05           ` [PATCH v2 2/4] Add a script to edit/inspect notes Johannes Schindelin
2008-12-20 12:05           ` [PATCH v2 3/4] Speed up git notes lookup Johannes Schindelin
2008-12-20 12:06           ` [PATCH v2 4/4] Add an expensive test for git-notes Johannes Schindelin
2008-12-19 23:35     ` [PATCH 2/4] Add a script to edit/inspect notes Johannes Schindelin
2008-12-19 23:35     ` [PATCH 3/4] Speed up git notes lookup Johannes Schindelin
2008-12-19 23:37     ` [PATCH 4/4] Add an expensive test for git-notes Johannes Schindelin
2008-12-19 23:49       ` Boyd Stephen Smith Jr.
2008-12-20 11:51         ` 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=200812171015.45303.johan@herland.net \
    --to=johan@herland.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=govind@sophiasuchtig.com \
    --cc=peff@peff.net \
    /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).