Thread (22 messages) 22 messages, 6 authors, 2016-06-15

Re: [PATCH] drop support for "experimental" loose objects

flat view

From: Jeff King <hidden>
Date: 2016-06-15 22:59:18
Subsystem: the rest · Maintainer: Linus Torvalds

On Thu, Nov 21, 2013 at 09:19:25PM +0100, Christian Couder wrote:
Yeah, I think it might report wrong size in case of replaced objects
for example.
I looked at that following Junio's comment about the
sha1_object_info() API, which,
unlike read_sha1_file() API, does not interact with the "replace" mechanism:

http://thread.gmane.org/gmane.comp.version-control.git/234023/

I started to work on a patch about this but didn't take the time to
finish and post it.
That seems kind of crazy. Would the fix be as simple as this:
diff --git a/sha1_file.c b/sha1_file.c
index 10676ba..a051d6c 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2529,6 +2529,8 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi)
 	struct pack_entry e;
 	int rtype;
 
+	sha1 = lookup_replace_object(sha1);
+
 	co = find_cached_object(sha1);
 	if (co) {
 		if (oi->typep)
or do we need some way for callers to turn off replacement? I notice
that read_sha1_file has such a feature, but it is only used in one
place. I guess we would need to audit all the sha1_object_info callers.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help