{"thread":{"id":"3948","subject":"git-clone --reference problem?","startedAt":"2006-04-23T16:34:40Z","lastAt":"2006-04-24T08:12:22Z","messageCount":5,"participants":["David Woodhouse","Junio C Hamano","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"19019","messageId":"1145810080.16166.223.camel@shinybook.infradead.org","threadId":"3948","inReplyTo":null,"subject":"git-clone --reference problem?","fromName":"David Woodhouse","fromEmail":"dwmw2@infradead.org","sentAt":"2006-04-23T16:34:40Z","receivedAt":"2006-04-23T16:34:40Z","isPatch":false,"sender":{"key":"dwmw2@infradead.org","avatar":"https://gravatar.com/avatar/7afd4f07e0cf7d7e046ae2d23678296b37777c96488e6f3451e78a5514154ebd?d=mp&s=160"},"body":"Should I expect cloning with alternates using '--reference' to be\ntransitive?\n\nUsing '--reference clone1 --reference linux-2.6' for the second clone\nworks OK, but surely it ought to work with just '--reference clone1'? \n\nIt doesn't work -- it can't find the objects which are in the original\nlinux-2.6 tree....\n\n (linux-2.6 contains a current copy of linus' tree)\n\nshinybook /shiny/git $ git-clone --reference linux-2.6 git://git.infradead.org/mtd-2.6.git clone1\nChecking files out...\n 100% (19552/19552) done\nshinybook /shiny/git $ git-clone --reference clone1 git://git.infradead.org/mtd-2.6.git clone2\nerror: refs/reference-tmp/refs/tags/v2.6.13-rc7 does not point to a valid commit object!\nerror: refs/reference-tmp/refs/tags/v2.6.13-rc2 does not point to a valid commit object!\nerror: refs/reference-tmp/refs/tags/v2.6.14 does not point to a valid commit object!\n   < ..... >\nerror: refs/reference-tmp/refs/tags/v2.6.14-rc1 does not point to a valid commit object!\nerror: refs/reference-tmp/refs/tags/v2.6.15-rc2 does not point to a valid commit object!\nerror: refs/reference-tmp/refs/tags/v2.6.13-rc6 does not point to a valid commit object!\nerror: refs/reference-tmp/refs/tags/v2.6.13-rc4 does not point to a valid commit object!\nerror: Could not read 7e6684741b15e98dd52bd0dbcb08a4eb69857c23\nerror: Could not read 7e6684741b15e98dd52bd0dbcb08a4eb69857c23\nerror: Could not read 7260448207915a170bb812f8639a90a30329adce\nerror: Could not read 7260448207915a170bb812f8639a90a30329adce\nerror: Could not read acf8d9bd83be879328c558400d94ee61fc229672\nerror: Could not read acf8d9bd83be879328c558400d94ee61fc229672\nerror: Could not read c7270e76718f635bed33afe6c4751a270b2d031b\nerror: Could not read c7270e76718f635bed33afe6c4751a270b2d031b\nerror: Could not read 0a8763981774041f3fee0a71e016dcaa096fa3f8\nerror: Could not read 0a8763981774041f3fee0a71e016dcaa096fa3f8\nerror: Could not read 4a47136ddde07488a5741e6be267b8f5bddc407b\nerror: Could not read 4a47136ddde07488a5741e6be267b8f5bddc407b\nerror: Could not read 6cad1d2664ec091ba5a6f3e3e552cf550ec8c2e0\nerror: Could not read 6cad1d2664ec091ba5a6f3e3e552cf550ec8c2e0\n   < ..... >\nerror: Could not read a0d4c65cd5642e7f7bbd2f806a69d20b2e43edc4\nerror: Could not read 611dd7a56906343db81c9fe340be0eb78c4ec260\nerror: Could not read 611dd7a56906343db81c9fe340be0eb78c4ec260\nerror: Could not read 227b4665ae0105348868d7a0a577209c8d16c6e3\nerror: Could not read 227b4665ae0105348868d7a0a577209c8d16c6e3\nerror: Could not read 9f19a4bfe0d0f0d203113d34d7455ceb82ff8341\nerror: Could not read 9f19a4bfe0d0f0d203113d34d7455ceb82ff8341\nChecking files out...\nerror: git-checkout-index: unable to read sha1 file of .gitignore (27fd37621255799602d74e94d670ff7a1658d40a)\nerror: git-checkout-index: unable to read sha1 file of COPYING (ca442d313d86dc67e0a2e5d584b465bd382cbf5c)\nerror: git-checkout-index: unable to read sha1 file of CREDITS (787564bc248b1d6125fc42f3932966b60aa2f7f4)\nerror: git-checkout-index: unable to read sha1 file of Kbuild (2d4f95e4b89f7f81da6cb94b07e8449b3689ba37)\nerror: git-checkout-index: unable to read sha1 file of Makefile (fc8e08c419f09e81252f3aa41cb7f47524c0af60)\nerror: git-checkout-index: unable to read sha1 file of README (05e055530bbb687599dd732d6753c77ffa281ae5)\n   < .....> \n\n-- \ndwmw2\n"},{"id":"19020","messageId":"7vmzecgozz.fsf@assigned-by-dhcp.cox.net","threadId":"3948","inReplyTo":"1145810080.16166.223.camel@shinybook.infradead.org","subject":"Re: git-clone --reference problem?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-04-23T17:50:40Z","receivedAt":"2006-04-23T17:50:40Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Woodhouse <dwmw2@infradead.org> writes:\n\n> Should I expect cloning with alternates using '--reference' to be\n> transitive?\n\nNot with the current code and design, but a patch that cleanly\ndoes that can be considered for inclusion.  Adjusting relative\npaths obtained from other repositories correctly, and avoiding\ncircular alternates by mistake would be tricky, though.\n"},{"id":"19021","messageId":"Pine.LNX.4.64.0604231122490.3701@g5.osdl.org","threadId":"3948","inReplyTo":"1145810080.16166.223.camel@shinybook.infradead.org","subject":"Re: git-clone --reference problem?","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-04-23T18:34:24Z","receivedAt":"2006-04-23T18:34:24Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sun, 23 Apr 2006, David Woodhouse wrote:\n>\n> Should I expect cloning with alternates using '--reference' to be\n> transitive?\n\nWell, certainly not now.\n\n> Using '--reference clone1 --reference linux-2.6' for the second clone\n> works OK, but surely it ought to work with just '--reference clone1'? \n\nActually, I don't think using \"--reference clone1 --reference linux-2.6\" \nworks OK at all - in the sense that it doesn't do what you _think_ it \ndoes.\n\nIt doesn't use two reference repos at all: it uses just one, which is the \nlast one (ie linux-2.6).\n\nMaybe something like this could work.\n\nUntested, of course. It probably isn't even syntactically correct shell. \nWhatever. You get the idea.\n\n(That while-loop could probably be simplified to just a \n\n  cat \"\"$reference/objects/info/alternates\" >> \"$GIT_DIR/objects/info/alternates\"\n\nbecause all alternates _should_ already be absolute paths, but hey, \nwhatever. I also forget whether we decided that non-absolute paths were \nrelative to the $reference directory, or to the $reference/objects/ \ndirectory. The while-loop should be fixed to match whatever that decision \nwas (or just not accept anything but absolute paths: make it use a\n\n\tgrep '^/' ..\n\ninstead of \"cat\"?)\n\n\t\tLinus\n\n---\ndiff --git a/git-clone.sh b/git-clone.sh\nindex 0805168..df4c135 100755\n--- a/git-clone.sh\n+++ b/git-clone.sh\n@@ -221,6 +221,13 @@ then\n \t\tfi\n \t\treference=$(cd \"$reference\" && pwd)\n \t\techo \"$reference/objects\" >\"$GIT_DIR/objects/info/alternates\"\n+\t\tif test -s \"$reference/objects/info/alternates\"\n+\t\tthen\n+\t\t\twhile read alt\n+\t\t\tdo\n+\t\t\t\techo $(cd \"$reference\" && cd \"$alt\" && pwd) >> \"$GIT_DIR/objects/info/alternates\"\n+\t\t\tdone < \"$reference/objects/info/alternates\"\n+\t\tfi\n \t\t(cd \"$reference\" && tar cf - refs) |\n \t\t(cd \"$GIT_DIR/refs\" &&\n \t\t mkdir reference-tmp &&\n"},{"id":"19022","messageId":"Pine.LNX.4.64.0604231137580.3701@g5.osdl.org","threadId":"3948","inReplyTo":"Pine.LNX.4.64.0604231122490.3701@g5.osdl.org","subject":"Re: git-clone --reference problem?","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-04-23T18:40:44Z","receivedAt":"2006-04-23T18:40:44Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sun, 23 Apr 2006, Linus Torvalds wrote:\n>\n> I also forget whether we decided that non-absolute paths were \n> relative to the $reference directory, or to the $reference/objects/ \n> directory.\n\nJust checked. It should be relative to $reference/objects, and we should \nstrip out lines that start with '#', since we allow comments.\n\nBlah. That whole shell-thing is cerainly convenient for prototyping, but \nit would be wonderful if we had some enterprising young soul that rewrote \nthese things in C and made them built-ins. It may be wasteful to use C for \nthis, but it would make portability easier, and we have all those nice \nroutines for validating and building alternate db lists already that do it \nright.\n\nOh, well.\n\n\t\tLinus\n"},{"id":"19040","messageId":"7vmzeb8k9l.fsf@assigned-by-dhcp.cox.net","threadId":"3948","inReplyTo":"Pine.LNX.4.64.0604231122490.3701@g5.osdl.org","subject":"Re: git-clone --reference problem?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-04-24T08:12:22Z","receivedAt":"2006-04-24T08:12:22Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> Maybe something like this could work.\n>\n> Untested, of course. It probably isn't even syntactically correct shell. \n> Whatever. You get the idea.\n>\n> (That while-loop could probably be simplified to just a \n>\n>   cat \"\"$reference/objects/info/alternates\" >> \"$GIT_DIR/objects/info/alternates\"\n>\n> because all alternates _should_ already be absolute paths, but hey, \n> whatever.\n\nI was hoping that the solution would be to do the recursive\nalternate resolution on the runtime side (IOW, prepare_alt_odb()\nin sha1_file.c).  Then the repository you borrow from _could_\nchange its own alternates after you set up your repository to\nborrow from it.\n\nCurrently, if the repository you borrowed from suddenly starts\nborrowing from somewhere else and pruned itself by running\n\"repack -a -d -l\", the borrower would be in trouble, even with\nyour patch.\n"}]}