All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philip Oakley" <philipoakley@iee.org>
To: "Junio C Hamano" <gitster@pobox.com>, "Mike Hommey" <mh@glandium.org>
Cc: <git@vger.kernel.org>
Subject: Re: Should notes handle replace commits?
Date: Sat, 9 Jan 2016 17:39:13 -0000	[thread overview]
Message-ID: <181337AE5CFC4AF09B82187B8E97095D@PhilipOakley> (raw)
In-Reply-To: xmqqmvsfzhq4.fsf@gitster.mtv.corp.google.com


From: "Junio C Hamano" <gitster@pobox.com>
Sent: Saturday, January 09, 2016 1:04 AM
> Mike Hommey <mh@glandium.org> writes:
>
>> So while `cat-file commit A` gives you what `cat-file commit Z` would,
>> `notes show A` doesn't give you what `notes show Z` would. And that's
>> this "inconsistency" that bothers me.
>
> In any case, 'notes' being a way to add extra information to an
> existing object means that with your original "replace" that tells
> Git to keep A in the history (and give Z's contents when contents of
> A was asked),
>     it is absolutely correct that notes for A is shown.

This seems very wrong to me. Surely we have asked that _all_ references to A 
be replaced by a reference to Z and thence onward to Z's contents.

That is, unless 'git --no-replace-objects' was given as an option.

It is as if everything about the old 'A' has been deleted, and new content 
'Z' replaces it.

In this case surely we want the notes about the contents of the new Z. To 
mix up the old and new will cause confusion, as evidenced by Mike's post.

> It would make no sense if notes for Z "followed", because as long as
> Git is concerned, you told Git to show A when your "git log master"
> followed the history down thru B to its parent, which you did not
> rewrite to be Z but kept to be A.  With the approach to replace B
> with B' that has Z as its parent, when "git log master" follows the
> history down thru C to its parent, Git thinks it is showing B but
> reads B', and finds out its parent is Z and goes down to Z, and
> notes for these two commits B and Z (not B' and Z) would be shown;
> there is no need to "follow".
>
> The true source of your confusion, I think, is that there is a
> misunderstanding of what "replace A with Z" does.
>
> It is not "whenever somebody refers to A, pretend as if it is
> referring to Z".  If that _were_ the case, then I'd agree that
> "whenever somebody else asks notes attached to A, pretend as if
> notes attached to Z were asked" might make sense, but that does not
> match the reality.

I think Mike is pointing out that it is only for notes that this alternate 
reality unexpectedly happens.

>
> It is not graft vs replace.  It is about what you replace with what
> other thing: "replace" is a content replacement mechanism, not
> identity replacement mechanism.

Part of the graft vs replace difficulty (historically) was that a graft 
(easy to use) will keep all the commits, and add a traversal link, while 
replace would essentially 'delete' one of the commits (users did not have a 
spare commit to delete if linking histories). The newer --graft option is 
now the appropriate method of creating an extra commit (that has the extra 
traverse linkage) that can then be 'deleted' and replaced by the commit on 
the other traverse chain.

There is the case where we have a string of commits (A-B-C-D-E) and we 
simply want to swap out commit C and replace it with a new commit C' to 
create (A-B-C'-D-E). A new C' would be prepared, and then upon replacement 
of C by C' we have to ask "What should be done about the old notes that were 
attached to C?".

I think that it maybe here that the issue lies. Some will think that the 
notes of the old C should still be attached to that location in the string, 
while others may think that it's for the user to both notice, and check the 
veracity, and only then carry those old notes across to the new C' 
(manually).

--
Philip

> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  parent reply	other threads:[~2016-01-09 17:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-08  1:28 Should notes handle replace commits? Mike Hommey
2016-01-08 20:09 ` Junio C Hamano
2016-01-08 21:49   ` Mike Hommey
2016-01-08 23:51     ` Junio C Hamano
2016-01-09  0:13       ` Junio C Hamano
2016-01-09  0:32         ` Mike Hommey
2016-01-09  0:25       ` Mike Hommey
2016-01-09  1:04         ` Junio C Hamano
2016-01-09  1:25           ` Mike Hommey
2016-01-11 16:09             ` Junio C Hamano
2016-01-09 17:39           ` Philip Oakley [this message]
2016-01-11 16:50             ` Junio C Hamano

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=181337AE5CFC4AF09B82187B8E97095D@PhilipOakley \
    --to=philipoakley@iee.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mh@glandium.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.