All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pretend-sha1: grave bugfix.
@ 2007-02-16  1:16 Junio C Hamano
  2007-02-16  4:05 ` Johannes Schindelin
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2007-02-16  1:16 UTC (permalink / raw)
  To: git

We stashed away objects that we pretend to have, but did not save the
actual data.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

 * I wonder how recent merge-recursive with multiple merge bases
   (or an empty one) ever worked with this bug.  Am I
   hallucinating?

 sha1_file.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/sha1_file.c b/sha1_file.c
index b83f59f..2c87031 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1545,11 +1545,13 @@ int pretend_sha1_file(void *buf, unsigned long len, const char *type, unsigned c
 	co = &cached_objects[cached_object_nr++];
 	co->size = len;
 	co->type = strdup(type);
+	co->buf = xmalloc(len);
+	memcpy(co->buf, buf, len);
 	hashcpy(co->sha1, sha1);
 	return 0;
 }
 
-void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size)
+void *read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size)
 {
 	unsigned long mapsize;
 	void *map, *buf;
-- 
1.5.0.31.g78e90

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] pretend-sha1: grave bugfix.
  2007-02-16  1:16 [PATCH] pretend-sha1: grave bugfix Junio C Hamano
@ 2007-02-16  4:05 ` Johannes Schindelin
  2007-02-16  5:09   ` Shawn O. Pearce
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2007-02-16  4:05 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi,

On Thu, 15 Feb 2007, Junio C Hamano wrote:

>  * I wonder how recent merge-recursive with multiple merge bases
>    (or an empty one) ever worked with this bug.  Am I
>    hallucinating?

Probably the fact helped that merge-recursive only pretends 
zero-sized blobs.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pretend-sha1: grave bugfix.
  2007-02-16  4:05 ` Johannes Schindelin
@ 2007-02-16  5:09   ` Shawn O. Pearce
  2007-02-16  7:29     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Shawn O. Pearce @ 2007-02-16  5:09 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, git

Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> On Thu, 15 Feb 2007, Junio C Hamano wrote:
> 
> >  * I wonder how recent merge-recursive with multiple merge bases
> >    (or an empty one) ever worked with this bug.  Am I
> >    hallucinating?
> 
> Probably the fact helped that merge-recursive only pretends 
> zero-sized blobs.

Most definately.  We never look at the pointer to an object's data if
len == 0, which it does in this case of merge-recursive's empty tree.

Aren't we using this for git-blame --contents?  How'd that ever
work for a non-empty file?

-- 
Shawn.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pretend-sha1: grave bugfix.
  2007-02-16  5:09   ` Shawn O. Pearce
@ 2007-02-16  7:29     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2007-02-16  7:29 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Johannes Schindelin, git

"Shawn O. Pearce" <spearce@spearce.org> writes:

> Aren't we using this for git-blame --contents?  How'd that ever
> work for a non-empty file?

My guess is that git-blame's blob handling has its own built-in
cache to avoid read_sha1_file(), and that single "initial" blob
is primed by hand, so read_sha1_file() is usually not called for
that object name.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-02-16  7:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-16  1:16 [PATCH] pretend-sha1: grave bugfix Junio C Hamano
2007-02-16  4:05 ` Johannes Schindelin
2007-02-16  5:09   ` Shawn O. Pearce
2007-02-16  7:29     ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.