git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Elijah Newren <newren@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>, Git Mailing List <git@vger.kernel.org>
Subject: Re: Bug report: git branch behaves as if --no-replace-objects is passed
Date: Tue, 30 Mar 2021 15:43:32 -0700	[thread overview]
Message-ID: <CABPp-BEVFi+EsGMCv=qEhe_OGwmWwXF-mg9rjWYNuF0tDZnASg@mail.gmail.com> (raw)
In-Reply-To: <xmqqa6qkcnqa.fsf@gitster.g>

On Tue, Mar 30, 2021 at 2:53 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Elijah Newren <newren@gmail.com> writes:
>
> > Using your own words:
> >
> > "the replace mechanism is about telling Git: when anybody refers to
> > deadbeef, use its replacement if defined instead."
>
> "When anybody wants the contents of deadbeef, give the contents of
> its replacement" is what the replace (graft, too) is.
>
> > git branch didn't do that; it put deadbeef into refs/heads/foobar.
>
> Yes, but refs/heads/foobar having deadbeef does not have a problem,
> as long as you get the contents of the replacement object when you
> ask for the contents of deadbeef (or "the object referred to by
> the refs/heads/foobar ref").

Your "as long as" is I think the assumption that's violated in the
workflow in question.  You may have the replace ref defined, but
others don't[1].  Neither party has the actual original deadbeef
commit[2].  Having deadbeef in refs/heads/foobar leads eventually to
creating commits with deadbeef as an explicit parent, as we discussed
above.  While that's internally consistent, as you point out, can you
push your new commit elsewhere without pushing the replace refs too?

* If you can, isn't that repository corruption?

* If you can't, how are users supposed to understand, debug, and
correct the fact that their history is unshareable?

Why does `git branch` (in conjunction with one user deciding to fetch
replace refs) make it so easy to create a branch that cannot readily
be shared with others?


[1] Everyone can get the replace refs, but fetch/clone does not grab
them by default, and push does not include them by default, so it's
multiple manual steps.
[2] For the rewrite at $DAYJOB, we'll make it as hard as possible for
users to access the original deadbeef commit(s).  People who cloned
the old unrewritten repo in the past might still have it somewhere if
they didn't follow instructions to delete old clones and reclone, but
new hires won't have deadbeef and won't have a way to get it.

  reply	other threads:[~2021-03-30 22:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30  6:05 Bug report: git branch behaves as if --no-replace-objects is passed Elijah Newren
2021-03-30  7:02 ` Jeff King
2021-03-30 18:58   ` Junio C Hamano
2021-03-30 21:19     ` Elijah Newren
2021-03-30 21:30       ` Elijah Newren
2021-03-30 21:59         ` Junio C Hamano
2021-03-30 21:53       ` Junio C Hamano
2021-03-30 22:43         ` Elijah Newren [this message]
2021-03-30 23:04           ` Junio C Hamano
2021-03-31  0:32             ` Elijah Newren

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABPp-BEVFi+EsGMCv=qEhe_OGwmWwXF-mg9rjWYNuF0tDZnASg@mail.gmail.com' \
    --to=newren@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).