From: Christian Couder <chriscool@tuxfamily.org>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: git@vger.kernel.org, Nick Edelen <sirnot@gmail.com>,
Sam Vilain <sam@vilain.net>
Subject: Re: Using ‘git replace’ to replace blobs
Date: Sun, 7 Feb 2010 07:45:59 +0100 [thread overview]
Message-ID: <201002070746.00200.chriscool@tuxfamily.org> (raw)
In-Reply-To: <20100207011056.GA15307@progeny.tock>
On dimanche 07 février 2010, Jonathan Nieder wrote:
> I think it is a known problem that ‘git replace’ cannot be used safely
> to replace blobs used in the currently checked out commit. The man
> page says:
>
> Comparing blobs or trees that have been replaced with
> those that replace them will not work properly.
>
> Indeed, in practice it produces problems. [1]
>
> I would like to start to fix this.
One way to fix it may be to use a bit in "struct object" that could tell if
any object was replaced or not. I think that in the "Add caching support to
git-daemon" GSoc patches, Nick Edelen did something like that for grafts.
(See http://thread.gmane.org/gmane.comp.version-control.git/127932/)
> But the correct semantics are not
> obvious to me:
>
> - When writing a tree from an index that includes replaced blobs,
> should the result use the original blobs or the replaced ones?
It may depend on why the original blob was replaced in the first place.
I did not think much about this though.
> - When reading a tree that includes replaced blobs, should the
> resulting cache entries use the original blobs or the replaced
> ones?
I think it should depend on whether the global variable read_replace_refs is
set or not.
> My hunch is to say both should use the replaced blobs. This way,
> replacing a blob in a checked-out index would behave in a more
> intuitive way, and git filter-branch would make permanent any
> substitutions requested through replaced blob entries.
It might not always be a good idea to make any substitution permanent.
For example if you use git replace to improve the bisectability of your
commit history you may want to keep the original commits.
I know you are talking about blobs, not commits, but perhaps there are some
similar use cases of replaced blobs.
Thanks for looking at that,
Christian.
prev parent reply other threads:[~2010-02-07 6:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-07 1:10 Using ‘git replace’ to replace blobs Jonathan Nieder
2010-02-07 6:45 ` Christian Couder [this message]
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=201002070746.00200.chriscool@tuxfamily.org \
--to=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=sam@vilain.net \
--cc=sirnot@gmail.com \
/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).