git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Hommey <mh@glandium.org>
To: git@vger.kernel.org
Subject: Should notes handle replace commits?
Date: Fri, 8 Jan 2016 10:28:30 +0900	[thread overview]
Message-ID: <20160108012830.GA2110@glandium.org> (raw)

Hi,

Take the following dummy repo:

  $ git init
  $ git commit --allow-empty -m 'first'
  $ git notes add -m 'first note'
  $ git commit --allow-empty -m 'second'
  $ git notes add -m 'second note'
  $ git commit --allow-empty -m 'third'
  $ git notes add -m 'third note'

  $ git log --format='%s - %N'
  third - third note

  second - second note

  first - first note

Now, let's say you have some other history that you want to graft:

  $ git checkout --orphan old
  $ git commit --allow-empty -m 'real first'
  $ git notes add -m 'real first note'
  $ git commit --allow-empty -m 'real second'
  $ git notes add -m 'real second note'
  $ git commit --allow-empty -m 'real third'
  $ git notes add -m 'real third note'
  $ git log --format='%s - %N'
  real third - real third note

  real second - real second note

  real first - real first note

Assuming that the "first" commit on master is the same as the "real
third" on old, you can graft with:

  $ git rev-parse master~ old | xargs > .git/info/grafts

And then:
  $ git log master --format='%s - %N'
  third - third note

  second - second note

  real third - real third note

  real second - real second note

  real first - real first note

Now, if you try to do the same with replace:

  $ rm .git/info/grafts
  $ git replace master~2 old
  $ git log master --format='%s - %N'
  third - third note

  second - second note

  real third - first note

  real second - real second note

  real first - real first note

Note how "real third" now has "first note", instead of "real third
note".

So the question is, is this the behavior this should have?

Cheers,

Mike

             reply	other threads:[~2016-01-08  2:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-08  1:28 Mike Hommey [this message]
2016-01-08 20:09 ` Should notes handle replace commits? 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
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=20160108012830.GA2110@glandium.org \
    --to=mh@glandium.org \
    --cc=git@vger.kernel.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 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).