From: Jeff King <peff@peff.net>
To: Christian Couder <christian.couder@gmail.com>
Cc: Joey Hess <joey@kitenet.net>, git <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] drop support for "experimental" loose objects
Date: Fri, 22 Nov 2013 11:15:59 -0500 [thread overview]
Message-ID: <20131122161558.GA4170@sigill.intra.peff.net> (raw)
In-Reply-To: <CAP8UFD1z4NsmgzrnPmqHo7CkNRkgg24qT2SGnFjhjrzckdKoTQ@mail.gmail.com>
On Fri, Nov 22, 2013 at 03:23:31PM +0100, Christian Couder wrote:
> > The only site which calls read_sha1_file_extended directly and does not
> > pass the REPLACE flag is in streaming.c. And that looks to be a case of
> > (2), since we resolve the replacement at the start in open_istream().
>
> Yeah, you are right. Sorry for overlooking this.
>
> But anyway it looks redundant to me to have both this REPLACE flag and
> the read_replace_refs global variable, so I think a proper solution
> would involve some significant refactoring.
I don't think it is redundant. The global variable is about "does the
whole operation want the replace feature turned on" and the flag is
about "does this particular callsite want the replace featured turned
on". We use the feature iff both are true.
We could implement the callsite flag by tweaking the global right before
the call to read_sha1_file, but then we would have to remember to turn
it back on afterwards. If this were a language with dynamic scopes like
Perl, that would be easy. But in C you have to remember to reset it in
all code paths. :)
In some cases it does make sense to turn the feature off for a whole
command (like pack-objects); using the global makes sense there. And
indeed, we seem to do it already in things like fsck, index-pack, etc.
So that answers my question of why I did not see more of case (1) in my
previous email: they do not need per-callsite disabling, because they do
it for the whole command.
> And if we decide to keep a REPLACE flag we might need to add one to
> sha1_object_info_extended() too.
Yes, but somebody needs to look at all of the callsites and decide which
form they want. :)
I did a brief skim, and the ones I noticed were:
- several spots in index-pack, pack-objects, etc. But these are
already covered by unsetting read_replace_refs.
- replace_object looks at both the original and new object to compare
their types (due to your recent patches); it would obviously want to
get the true type of the original object
- When creating tags and trees, we care about the type of the object
(the former for the "type" line of the tag, the latter to set the
mode). What should they do with replace objects? As above, it is
probably insane to switch types, so it may not matter for practical
purposes.
- istream_source in streaming.c would probably want to turn it off for
the same reason it uses read_sha1_file_extended
So I think most sites would be unaffected, but due to the second and
fourth item in my list above, we would need a flag for
sha1_object_info_extended.
-Peff
next prev parent reply other threads:[~2013-11-22 16:16 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-20 20:33 corrupt object memory allocation error Joey Hess
2013-11-20 21:33 ` Jeff King
2013-11-20 22:28 ` Joey Hess
2013-11-21 11:41 ` [PATCH] drop support for "experimental" loose objects Jeff King
2013-11-21 11:48 ` Jeff King
2013-11-21 12:43 ` Duy Nguyen
2013-11-21 14:42 ` Keshav Kini
2013-11-21 22:41 ` Jeff King
2013-11-21 19:44 ` Junio C Hamano
2013-11-23 0:24 ` Jonathan Nieder
2013-11-23 0:30 ` Jeff King
2013-11-23 0:47 ` Jonathan Nieder
2013-11-21 16:04 ` Joey Hess
2013-11-21 20:19 ` Christian Couder
2013-11-22 9:58 ` Jeff King
2013-11-22 11:04 ` Christian Couder
2013-11-22 11:24 ` Jeff King
2013-11-22 14:23 ` Christian Couder
2013-11-22 16:15 ` Jeff King [this message]
2013-11-22 17:23 ` Junio C Hamano
2013-11-22 2:09 ` Jeff King
2013-11-22 17:28 ` Joey Hess
2013-11-24 8:44 ` Jeff King
2013-11-24 9:07 ` Jeff King
2013-11-25 18:35 ` Junio C Hamano
2013-11-27 9:30 ` Jeff King
2013-11-27 18:57 ` Junio C Hamano
2013-11-27 19:03 ` Jeff King
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=20131122161558.GA4170@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=joey@kitenet.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).