{"thread":{"id":"2270","subject":"Problem with cg-clone","startedAt":"2005-10-29T17:08:46Z","lastAt":"2005-10-29T20:19:25Z","messageCount":6,"participants":["Marcel Holtmann","Junio C Hamano","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"10794","messageId":"1130605726.5396.39.camel@blade","threadId":"2270","inReplyTo":null,"subject":"Problem with cg-clone","fromName":"Marcel Holtmann","fromEmail":"marcel@holtmann.org","sentAt":"2005-10-29T17:08:46Z","receivedAt":"2005-10-29T17:08:46Z","isPatch":false,"sender":{"key":"marcel@holtmann.org","avatar":null},"body":"Hi guys,\n\nI installed the latest git and cogito from their repositories and now\nthe local clone command is failing:\n\n# cg-clone linux-2.6 test-2.6\ndefaulting to local storage area\nUsing hard links\n`/data/kernel/linux-2.6/.git/HEAD' -> `.git/refs/heads/.origin-fetching'\nerror: Couldn't find 8a212ab6b8a4ccc6f3c3d1beba5f92655c576404: not separate or in any pack\nCannot obtain needed object 8a212ab6b8a4ccc6f3c3d1beba5f92655c576404\nwhile processing commit 0000000000000000000000000000000000000000.\ncg-fetch: objects fetch failed\ncg-clone: fetch failed\n\nPreviously this was working fine and since cogito hasn't changed the\nlast few days, I suspect that git is at fault here or changed something.\nAny ideas?\n\nRegards\n\nMarcel\n"},{"id":"10795","messageId":"7vacgs157c.fsf@assigned-by-dhcp.cox.net","threadId":"2270","inReplyTo":"1130605726.5396.39.camel@blade","subject":"Re: Problem with cg-clone","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-10-29T19:41:27Z","receivedAt":"2005-10-29T19:41:27Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marcel Holtmann <marcel@holtmann.org> writes:\n\n> Previously this was working fine and since cogito hasn't changed the\n> last few days, I suspect that git is at fault here or changed something.\n> Any ideas?\n\nI think I know what is going on.\n\ngit-init-db does not create .git/objects/[0-9a-f]{2}/\ndirectories anymore, but git-local-fetch has not taught to\ncreate them on demand.\n"},{"id":"10796","messageId":"Pine.LNX.4.64.0510291255230.3348@g5.osdl.org","threadId":"2270","inReplyTo":"7vacgs157c.fsf@assigned-by-dhcp.cox.net","subject":"Re: Problem with cg-clone","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-10-29T19:57:20Z","receivedAt":"2005-10-29T19:57:20Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sat, 29 Oct 2005, Junio C Hamano wrote:\n>\n> Marcel Holtmann <marcel@holtmann.org> writes:\n> \n> > Previously this was working fine and since cogito hasn't changed the\n> > last few days, I suspect that git is at fault here or changed something.\n> > Any ideas?\n> \n> I think I know what is going on.\n> \n> git-init-db does not create .git/objects/[0-9a-f]{2}/\n> directories anymore, but git-local-fetch has not taught to\n> create them on demand.\n\nHere's a quick hack, totally untested, of course.\n\nMore properly it should use move_temp_to_file(), but if you're about to do \na v0.99.9 release, maybe this could be good enough.\n\n\t\tLinus\n\n---\n\ndiff --git a/local-fetch.c b/local-fetch.c\nindex 87a93de..21f5bf8 100644\n--- a/local-fetch.c\n+++ b/local-fetch.c\n@@ -52,9 +52,20 @@ static int setup_indices(void)\n \treturn 0;\n }\n \n-static int copy_file(const char *source, const char *dest, const char *hex,\n+static int copy_file(const char *source, char *dest, const char *hex,\n \t\t     int warn_if_not_exists)\n {\n+\tchar *dir = strrchr(dest, '/');\n+\n+\tif (dir) {\n+\t\t*dir = 0;\n+\t\tif (mkdir(dir, 0777)) {\n+\t\t\tif (errno != EEXIST)\n+\t\t\t\tperror(dir);\n+\t\t}\n+\t\t*dir = '/';\n+\t}\n+\n \tif (use_link) {\n \t\tif (!link(source, dest)) {\n \t\t\tpull_say(\"link %s\\n\", hex);\n@@ -150,7 +161,7 @@ static int fetch_file(const unsigned cha\n \tstatic int object_name_start = -1;\n \tstatic char filename[PATH_MAX];\n \tchar *hex = sha1_to_hex(sha1);\n-\tconst char *dest_filename = sha1_file_name(sha1);\n+\tchar *dest_filename = sha1_file_name(sha1);\n \n  \tif (object_name_start < 0) {\n \t\tstrcpy(filename, path); /* e.g. git.git */\n"},{"id":"10797","messageId":"7vwtjwytzw.fsf@assigned-by-dhcp.cox.net","threadId":"2270","inReplyTo":"1130605726.5396.39.camel@blade","subject":"Re: Problem with cg-clone","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-10-29T19:59:31Z","receivedAt":"2005-10-29T19:59:31Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marcel Holtmann <marcel@holtmann.org> writes:\n\n> I installed the latest git and cogito from their repositories and now\n> the local clone command is failing:\n>\n> # cg-clone linux-2.6 test-2.6\n> defaulting to local storage area\n> Using hard links\n> `/data/kernel/linux-2.6/.git/HEAD' -> `.git/refs/heads/.origin-fetching'\n> error: Couldn't find 8a212ab6b8a4ccc6f3c3d1beba5f92655c576404: not separate or in any pack\n> Cannot obtain needed object 8a212ab6b8a4ccc6f3c3d1beba5f92655c576404\n> while processing commit 0000000000000000000000000000000000000000.\n> cg-fetch: objects fetch failed\n> cg-clone: fetch failed\n\nThe attached patch should fix git-local-fetch which I think the\nabove problem is.  git-clone -l -s would be much faster if you\nare doing a local clone, however.\n\n---\n\ndiff --git a/local-fetch.c b/local-fetch.c\nindex 87a93de..0a07114 100644\n--- a/local-fetch.c\n+++ b/local-fetch.c\n@@ -52,9 +52,10 @@ static int setup_indices(void)\n \treturn 0;\n }\n \n-static int copy_file(const char *source, const char *dest, const char *hex,\n+static int copy_file(const char *source, char *dest, const char *hex,\n \t\t     int warn_if_not_exists)\n {\n+\tsafe_create_leading_directories(dest);\n \tif (use_link) {\n \t\tif (!link(source, dest)) {\n \t\t\tpull_say(\"link %s\\n\", hex);\n@@ -150,7 +151,7 @@ static int fetch_file(const unsigned cha\n \tstatic int object_name_start = -1;\n \tstatic char filename[PATH_MAX];\n \tchar *hex = sha1_to_hex(sha1);\n-\tconst char *dest_filename = sha1_file_name(sha1);\n+\tchar *dest_filename = sha1_file_name(sha1);\n \n  \tif (object_name_start < 0) {\n \t\tstrcpy(filename, path); /* e.g. git.git */\n"},{"id":"10798","messageId":"1130616653.5396.56.camel@blade","threadId":"2270","inReplyTo":"7vwtjwytzw.fsf@assigned-by-dhcp.cox.net","subject":"Re: Problem with cg-clone","fromName":"Marcel Holtmann","fromEmail":"marcel@holtmann.org","sentAt":"2005-10-29T20:10:53Z","receivedAt":"2005-10-29T20:10:53Z","isPatch":false,"sender":{"key":"marcel@holtmann.org","avatar":null},"body":"Hi Junio,\n\n> > I installed the latest git and cogito from their repositories and now\n> > the local clone command is failing:\n> >\n> > # cg-clone linux-2.6 test-2.6\n> > defaulting to local storage area\n> > Using hard links\n> > `/data/kernel/linux-2.6/.git/HEAD' -> `.git/refs/heads/.origin-fetching'\n> > error: Couldn't find 8a212ab6b8a4ccc6f3c3d1beba5f92655c576404: not separate or in any pack\n> > Cannot obtain needed object 8a212ab6b8a4ccc6f3c3d1beba5f92655c576404\n> > while processing commit 0000000000000000000000000000000000000000.\n> > cg-fetch: objects fetch failed\n> > cg-clone: fetch failed\n> \n> The attached patch should fix git-local-fetch which I think the\n> above problem is.  git-clone -l -s would be much faster if you\n> are doing a local clone, however.\n\nI can confirm that with this patch everything is back to normal.\n\nRegards\n\nMarcel\n"},{"id":"10799","messageId":"7vslukyt2q.fsf@assigned-by-dhcp.cox.net","threadId":"2270","inReplyTo":"1130616653.5396.56.camel@blade","subject":"Re: Problem with cg-clone","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-10-29T20:19:25Z","receivedAt":"2005-10-29T20:19:25Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marcel Holtmann <marcel@holtmann.org> writes:\n\n>> The attached patch should fix git-local-fetch which I think the\n>> above problem is.  git-clone -l -s would be much faster if you\n>> are doing a local clone, however.\n>\n> I can confirm that with this patch everything is back to normal.\n\nThanks.  What Linus separately done (funny we did that\ntwo-minutes apart) amounts to the same thing.\n"}]}