{"thread":{"id":"8285","subject":"[PATCH] fast-import: Fix crash when referencing already existing objects","startedAt":"2007-05-23T21:01:49Z","lastAt":"2007-05-24T03:44:15Z","messageCount":2,"participants":["Simon Hausmann","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"43051","messageId":"200705232301.49667.simon@lst.de","threadId":"8285","inReplyTo":null,"subject":"[PATCH] fast-import: Fix crash when referencing already existing objects","fromName":"Simon Hausmann","fromEmail":"simon@lst.de","sentAt":"2007-05-23T21:01:49Z","receivedAt":"2007-05-23T21:01:49Z","isPatch":true,"sender":{"key":"hausmann@kde.org","avatar":"https://gravatar.com/avatar/bc9aad4fb31dce17eb66e690e7b51fe980c62da3c225c785da35dd806b8da778?d=mp&s=160"},"body":"Commit a5c1780a0355a71b9fb70f1f1977ce726ee5b8d8 sets the pack_id of existing\nobjects to MAX_PACK_ID. When the same object is referenced later again it is\nfound in the local object hash. With such a pack_id fast-import should not try\nto locate that object in the newly created pack(s).\n\nSigned-off-by: Simon Hausmann <simon@lst.de>\n---\n fast-import.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/fast-import.c b/fast-import.c\nindex 0ddf8fe..87eaada 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -1013,7 +1013,7 @@ static void load_tree(struct tree_entry *root)\n \t\treturn;\n \n \tmyoe = find_object(sha1);\n-\tif (myoe) {\n+\tif (myoe && myoe->pack_id != MAX_PACK_ID) {\n \t\tif (myoe->type != OBJ_TREE)\n \t\t\tdie(\"Not a tree: %s\", sha1_to_hex(sha1));\n \t\tt->delta_depth = 0;\n-- \n1.5.2.24.g93d4\n"},{"id":"43090","messageId":"20070524034415.GF28023@spearce.org","threadId":"8285","inReplyTo":"200705232301.49667.simon@lst.de","subject":"Re: [PATCH] fast-import: Fix crash when referencing already existing objects","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-05-24T03:44:15Z","receivedAt":"2007-05-24T03:44:15Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Simon Hausmann <simon@lst.de> wrote:\n> Commit a5c1780a0355a71b9fb70f1f1977ce726ee5b8d8 sets the pack_id of existing\n> objects to MAX_PACK_ID. When the same object is referenced later again it is\n> found in the local object hash. With such a pack_id fast-import should not try\n> to locate that object in the newly created pack(s).\n\nThanks, that was a _really_ nasty bug.  :-(\n\nTurns out there's more cases.  Such as if we reload a mark table of\ncommits (--import-marks) and then try to create a branch from them.\nThe existing commit will also have a pack_id of MAX_PACK_ID and\nwe'll go right into the same corruption you saw and fixed here.\n\nI will be pushing your two patches and my additional fixup to\nmy maint branch tonight.\n\n-- \nShawn.\n"}]}