git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fast-import: Fix crash when referencing already existing objects
@ 2007-05-23 21:01 Simon Hausmann
  2007-05-24  3:44 ` Shawn O. Pearce
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Hausmann @ 2007-05-23 21:01 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: git

Commit a5c1780a0355a71b9fb70f1f1977ce726ee5b8d8 sets the pack_id of existing
objects to MAX_PACK_ID. When the same object is referenced later again it is
found in the local object hash. With such a pack_id fast-import should not try
to locate that object in the newly created pack(s).

Signed-off-by: Simon Hausmann <simon@lst.de>
---
 fast-import.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fast-import.c b/fast-import.c
index 0ddf8fe..87eaada 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1013,7 +1013,7 @@ static void load_tree(struct tree_entry *root)
 		return;
 
 	myoe = find_object(sha1);
-	if (myoe) {
+	if (myoe && myoe->pack_id != MAX_PACK_ID) {
 		if (myoe->type != OBJ_TREE)
 			die("Not a tree: %s", sha1_to_hex(sha1));
 		t->delta_depth = 0;
-- 
1.5.2.24.g93d4

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

* Re: [PATCH] fast-import: Fix crash when referencing already existing objects
  2007-05-23 21:01 [PATCH] fast-import: Fix crash when referencing already existing objects Simon Hausmann
@ 2007-05-24  3:44 ` Shawn O. Pearce
  0 siblings, 0 replies; 2+ messages in thread
From: Shawn O. Pearce @ 2007-05-24  3:44 UTC (permalink / raw)
  To: Simon Hausmann; +Cc: git

Simon Hausmann <simon@lst.de> wrote:
> Commit a5c1780a0355a71b9fb70f1f1977ce726ee5b8d8 sets the pack_id of existing
> objects to MAX_PACK_ID. When the same object is referenced later again it is
> found in the local object hash. With such a pack_id fast-import should not try
> to locate that object in the newly created pack(s).

Thanks, that was a _really_ nasty bug.  :-(

Turns out there's more cases.  Such as if we reload a mark table of
commits (--import-marks) and then try to create a branch from them.
The existing commit will also have a pack_id of MAX_PACK_ID and
we'll go right into the same corruption you saw and fixed here.

I will be pushing your two patches and my additional fixup to
my maint branch tonight.

-- 
Shawn.

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

end of thread, other threads:[~2007-05-24  3:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-23 21:01 [PATCH] fast-import: Fix crash when referencing already existing objects Simon Hausmann
2007-05-24  3:44 ` Shawn O. Pearce

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).