{"thread":{"id":"30470","subject":"git-diff-tree does not use alternate objects for submodules","startedAt":"2012-05-08T13:42:08Z","lastAt":"2012-05-14T18:03:20Z","messageCount":12,"participants":["Orgad and Raizel Shaneh","Junio C Hamano","Heiko Voigt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"191091","messageId":"CAGHpTBLfbMU1WevW6XnY_N2BnfwPZ0_6jJDf45rCkVjWGwA9xg@mail.gmail.com","threadId":"30470","inReplyTo":null,"subject":"git-diff-tree does not use alternate objects for submodules","fromName":"Orgad and Raizel Shaneh","fromEmail":"orgads@gmail.com","sentAt":"2012-05-08T13:42:08Z","receivedAt":"2012-05-08T13:42:08Z","isPatch":false,"sender":{"key":"orgads@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1246544?v=4"},"body":"I have a project with a submodule. Both have objects/info/alternate\n(different ones).\n\nAfter running 'git gc', running gitk on the superproject results in:\n  Submodule sub 227e2b5...d8597e2 (commits not present)\n\nThis is the git-diff-tree command that gitk runs:\n  git diff-tree -r -p --textconv --submodule -C --cc --no-commit-id\n-U6 --root d117679ef4a4fb4143401d3a4bc4a484c9bf76ff\n\nI'm using msysGit 1.7.10\n\n- Orgad\n"},{"id":"191102","messageId":"7v1umuznuj.fsf@alter.siamese.dyndns.org","threadId":"30470","inReplyTo":"CAGHpTBLfbMU1WevW6XnY_N2BnfwPZ0_6jJDf45rCkVjWGwA9xg@mail.gmail.com","subject":"Re: git-diff-tree does not use alternate objects for submodules","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-08T15:36:36Z","receivedAt":"2012-05-08T15:36:36Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Orgad and Raizel Shaneh <orgads@gmail.com> writes:\n\n> I have a project with a submodule. Both have objects/info/alternate\n> (different ones).\n>\n> After running 'git gc', running gitk on the superproject results in:\n>   Submodule sub 227e2b5...d8597e2 (commits not present)\n\nWhen \"--submodule\" option was implemented in 752c0c, it was done with an\npremature and incomplete optimization, and I think you are seeing an\nunfortunate side effect of it. The code attempts to link the object store\nof the submodule repository into the in-core representation of the object\nstore of the superproject (in submodule.c::add_submodule_odb()), but does\nnot do a good job of it.  It does not take alternates into account, and\nwho knows what else is missing.  Sigh...\n\nThe right approach to implement this feature would have been to fork a\nchild process and perform the submodule operation inside the child, which\nwill chdir into the submodule and treat as if it is a freestanding git\nrepository, without contaminating the superproject process.\n\nFor now, an easiest workaround would be to rephrase the error message to\n\"commits not present\" to \"commit not present or missing\", or something.\n"},{"id":"191103","messageId":"7vwr4my98n.fsf@alter.siamese.dyndns.org","threadId":"30470","inReplyTo":"7v1umuznuj.fsf@alter.siamese.dyndns.org","subject":"Re: git-diff-tree does not use alternate objects for submodules","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-08T15:37:28Z","receivedAt":"2012-05-08T15:37:28Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> For now, an easiest workaround would be to rephrase the error message to\n> \"commits not present\" to \"commit not present or missing\", or something.\n\nI meant s/or missing/or borrowed/;  \"not present\" and \"missing\" are the\nsame thing ;-)\n"},{"id":"191245","messageId":"20120509215815.GC74366@book.hvoigt.net","threadId":"30470","inReplyTo":"7v1umuznuj.fsf@alter.siamese.dyndns.org","subject":"Re: git-diff-tree does not use alternate objects for submodules","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2012-05-09T21:58:17Z","receivedAt":"2012-05-09T21:58:17Z","isPatch":false,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"Hi,\n\nOn Tue, May 08, 2012 at 08:36:36AM -0700, Junio C Hamano wrote:\n> Orgad and Raizel Shaneh <orgads@gmail.com> writes:\n> \n> > I have a project with a submodule. Both have objects/info/alternate\n> > (different ones).\n> >\n> > After running 'git gc', running gitk on the superproject results in:\n> > ?? Submodule sub 227e2b5...d8597e2 (commits not present)\n> \n> When \"--submodule\" option was implemented in 752c0c, it was done with an\n> premature and incomplete optimization, and I think you are seeing an\n> unfortunate side effect of it. The code attempts to link the object store\n> of the submodule repository into the in-core representation of the object\n> store of the superproject (in submodule.c::add_submodule_odb()), but does\n> not do a good job of it.  It does not take alternates into account, and\n> who knows what else is missing.  Sigh...\n> \n> The right approach to implement this feature would have been to fork a\n> child process and perform the submodule operation inside the child, which\n> will chdir into the submodule and treat as if it is a freestanding git\n> repository, without contaminating the superproject process.\n> \n> For now, an easiest workaround would be to rephrase the error message to\n> \"commits not present\" to \"commit not present or missing\", or something.\n\nI will have a look if I can come up with something that reads the\nsubmodules alternate config and uses it. Do you have other config\nrelated things in mind that might be missing?\n\nCheers Heiko\n"},{"id":"191248","messageId":"7v1umtq9pm.fsf@alter.siamese.dyndns.org","threadId":"30470","inReplyTo":"20120509215815.GC74366@book.hvoigt.net","subject":"Re: git-diff-tree does not use alternate objects for submodules","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-09T22:19:01Z","receivedAt":"2012-05-09T22:19:01Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Heiko Voigt <hvoigt@hvoigt.net> writes:\n> On Tue, May 08, 2012 at 08:36:36AM -0700, Junio C Hamano wrote:\n> ...\n>> ... The code attempts to link the object store\n>> of the submodule repository into the in-core representation of the object\n>> store of the superproject (in submodule.c::add_submodule_odb()), but does\n>> not do a good job of it.  It does not take alternates into account, and\n>> who knows what else is missing.  Sigh...\n>> \n>> The right approach to implement this feature would have been to fork a\n>> child process and perform the submodule operation inside the child, which\n>> will chdir into the submodule and treat as if it is a freestanding git\n>> repository, without contaminating the superproject process.\n>\n> I will have a look if I can come up with something that reads the\n> submodules alternate config and uses it. Do you have other config\n> related things in mind that might be missing?\n\nNo, I do not, and that is exactly the point.\n\nMaking the process that works in the top-level superproject to imitate\nwhat would happen if the processing happened inside the submodule is what\ninvited a bug like this.  Who knows what other discrepancies remain there.\n\nIf we forked a separate process, and made it to chdir to the submodule\ntree, and had it do its usual thing there, we do not have to worry about\nhow good the imitation is, exactly because there won't be any imitation.\nThere will only be a git processing happening in the usual way inside the\nsubmodule directory, as if the end user cd'ed there and typed the \"git\nstatus\" command to see if the HEAD matches the given commit or if the\nworking tree is dirty.\n"},{"id":"191250","messageId":"7vwr4lotjl.fsf@alter.siamese.dyndns.org","threadId":"30470","inReplyTo":"7v1umtq9pm.fsf@alter.siamese.dyndns.org","subject":"Re: git-diff-tree does not use alternate objects for submodules","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-09T22:53:34Z","receivedAt":"2012-05-09T22:53:34Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Heiko Voigt <hvoigt@hvoigt.net> writes:\n> ...\n>> I will have a look if I can come up with something that reads the\n>> submodules alternate config and uses it. Do you have other config\n>> related things in mind that might be missing?\n>\n> No, I do not, and that is exactly the point.\n>\n> Making the process that works in the top-level superproject to imitate\n> what would happen if the processing happened inside the submodule is what\n> invited a bug like this.  Who knows what other discrepancies remain there.\n>\n> If we forked a separate process,...\n\nHaving said all that, we seem to have come too far and it is probably too\npainful to revert the approach to contaminate the obj_hash (in object.c),\nthe set of refs (in refs.c) and the like in the top-level superproject\nprocess with data borrowed from submodules repository [*1*].  So not only\nI do not mind seeing you try solving it inside the superproject process, I\nwould appreciate and encourage the attempt.  One thing to be careful about\nis relative paths stored in the objects/info/alternates; they are relative\nto the object database of the repository the \"alternates\" is specified,\nnot relative to the superproject that happens to contain the submodule.\n\nThanks.\n\n\n[Footnote]\n\n*1* This is a wrong approach not only because it will invite this kind of\nbug, but also because it will bloat the process working on the\nsuperproject.  When taken alone, either of the superproject or the\nsubmodule repository may be of comfortably workable size, but a single\nprocess that is working on the superproject may ran out of a per-process\nresource limit if it is made to also slurp data for the submodules,\nespecially when working on a project with dozens of submodules.\n"},{"id":"191468","messageId":"20120513172301.GA58961@book.hvoigt.net","threadId":"30470","inReplyTo":"7vwr4lotjl.fsf@alter.siamese.dyndns.org","subject":"Re: git-diff-tree does not use alternate objects for submodules","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2012-05-13T17:23:25Z","receivedAt":"2012-05-13T17:23:25Z","isPatch":false,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"Hi,\n\nOn Wed, May 09, 2012 at 03:53:34PM -0700, Junio C Hamano wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n> > Heiko Voigt <hvoigt@hvoigt.net> writes:\n> > ...\n> >> I will have a look if I can come up with something that reads the\n> >> submodules alternate config and uses it. Do you have other config\n> >> related things in mind that might be missing?\n> >\n> > No, I do not, and that is exactly the point.\n> >\n> > Making the process that works in the top-level superproject to imitate\n> > what would happen if the processing happened inside the submodule is what\n> > invited a bug like this.  Who knows what other discrepancies remain there.\n> >\n> > If we forked a separate process,...\n> \n> Having said all that, we seem to have come too far and it is probably too\n> painful to revert the approach to contaminate the obj_hash (in object.c),\n> the set of refs (in refs.c) and the like in the top-level superproject\n> process with data borrowed from submodules repository [*1*].  So not only\n> I do not mind seeing you try solving it inside the superproject process, I\n> would appreciate and encourage the attempt.  One thing to be careful about\n> is relative paths stored in the objects/info/alternates; they are relative\n> to the object database of the repository the \"alternates\" is specified,\n> not relative to the superproject that happens to contain the submodule.\n> \n> Thanks.\n\nHere is the simplest approach I could think of (not sure if its maybe\ntoo simple). On first sight it seems to work (even if I exchange the\nabsolute path in alternates with a relative one.\n\nPlease see below.\n\nCheers Heiko\n\nI used the following setup to test:\n\nmkdir sub_alt &&\n(cd sub_alt &&\ngit init &&\necho a >a &&\ngit add a &&\ngit commit -m a) &&\nmkdir super &&\n(cd super &&\ngit clone -s ../sub_alt sub &&\ngit init &&\ngit add sub &&\ngit commit -m \"sub a\") &&\n(cd sub_alt &&\necho b >b &&\ngit add b &&\ngit commit -m b) &&\n(cd super &&\n\t(cd sub &&\n\t git fetch &&\n\t git checkout origin/master) &&\n git diff --submodule\n)\n\n\n-8<--\nFrom: Heiko Voigt <hvoigt@hvoigt.net>\nSubject: [PATCH] teach add_submodule_odb() to look for alternates\n\nSince we allow to link other object databases when loading a submodules\ndatabase we should also load possible alternates.\n\nSigned-off-by: Heiko Voigt <hvoigt@hvoigt.net>\n---\n cache.h     | 1 +\n sha1_file.c | 3 +--\n submodule.c | 3 +++\n 3 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex e14ffcd..cc5048c 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -947,6 +947,7 @@ extern struct alternate_object_database {\n \tchar base[FLEX_ARRAY]; /* more */\n } *alt_odb_list;\n extern void prepare_alt_odb(void);\n+extern void read_info_alternates(const char * relative_base, int depth);\n extern void add_to_alternates_file(const char *reference);\n typedef int alt_odb_fn(struct alternate_object_database *, void *);\n extern void foreach_alt_odb(alt_odb_fn, void*);\ndiff --git a/sha1_file.c b/sha1_file.c\nindex 3c4f165..4ccaf7a 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -229,7 +229,6 @@ char *sha1_pack_index_name(const unsigned char *sha1)\n struct alternate_object_database *alt_odb_list;\n static struct alternate_object_database **alt_odb_tail;\n \n-static void read_info_alternates(const char * alternates, int depth);\n static int git_open_noatime(const char *name);\n \n /*\n@@ -354,7 +353,7 @@ static void link_alt_odb_entries(const char *alt, const char *ep, int sep,\n \t}\n }\n \n-static void read_info_alternates(const char * relative_base, int depth)\n+void read_info_alternates(const char * relative_base, int depth)\n {\n \tchar *map;\n \tsize_t mapsz;\ndiff --git a/submodule.c b/submodule.c\nindex 784b580..959d349 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -63,6 +63,9 @@ static int add_submodule_odb(const char *path)\n \talt_odb->name[40] = '\\0';\n \talt_odb->name[41] = '\\0';\n \talt_odb_list = alt_odb;\n+\n+\t/* add possible alternates from the submodule */\n+\tread_info_alternates(objects_directory.buf, 0);\n \tprepare_alt_odb();\n done:\n \tstrbuf_release(&objects_directory);\n-- \n1.7.10.1.491.gc66153e\n"},{"id":"191474","messageId":"20120513221333.GB59647@book.hvoigt.net","threadId":"30470","inReplyTo":"20120513172301.GA58961@book.hvoigt.net","subject":"Re: git-diff-tree does not use alternate objects for submodules","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2012-05-13T22:13:33Z","receivedAt":"2012-05-13T22:13:33Z","isPatch":false,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"On Sun, May 13, 2012 at 07:23:25PM +0200, Heiko Voigt wrote:\n> Here is the simplest approach I could think of (not sure if its maybe\n> too simple). On first sight it seems to work (even if I exchange the\n> absolute path in alternates with a relative one.\n> \n> Please see below.\n> \n> Cheers Heiko\n> \n> I used the following setup to test:\n> \n> mkdir sub_alt &&\n> (cd sub_alt &&\n> git init &&\n> echo a >a &&\n> git add a &&\n> git commit -m a) &&\n> mkdir super &&\n> (cd super &&\n> git clone -s ../sub_alt sub &&\n> git init &&\n> git add sub &&\n> git commit -m \"sub a\") &&\n> (cd sub_alt &&\n> echo b >b &&\n> git add b &&\n> git commit -m b) &&\n> (cd super &&\n> \t(cd sub &&\n> \t git fetch &&\n> \t git checkout origin/master) &&\n>  git diff --submodule\n> )\n\nJunio in case you decide to queue this: I would like to rework the above\ncode into a proper testcase and add that to the patch. The previous\npatch is the state as far as I got today so interested people can test\nwhether it fixes their issue.\n\nCheers Heiko\n"},{"id":"191498","messageId":"20120514162445.GA58058@book.hvoigt.net","threadId":"30470","inReplyTo":"20120513221333.GB59647@book.hvoigt.net","subject":"[PATCH v2] teach add_submodule_odb() to look for alternates","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2012-05-14T16:24:45Z","receivedAt":"2012-05-14T16:24:45Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"Since we allow to link other object databases when loading a submodules\ndatabase we should also load possible alternates.\n\nSigned-off-by: Heiko Voigt <hvoigt@hvoigt.net>\n---\nI had a look over the code path in read_info_alternates() and it seems\nthat it uses the relative_base parameter for relative paths in the\nalternates file which is the correct behavior.\n\nSo for me this looks like the correct solution. The testsuite passes.\n\nCheers Heiko\n\n cache.h                          |  1 +\n sha1_file.c                      |  3 +--\n submodule.c                      |  3 +++\n t/t4041-diff-submodule-option.sh | 34 ++++++++++++++++++++++++++++++++++\n 4 files changed, 39 insertions(+), 2 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex e14ffcd..cc5048c 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -947,6 +947,7 @@ extern struct alternate_object_database {\n \tchar base[FLEX_ARRAY]; /* more */\n } *alt_odb_list;\n extern void prepare_alt_odb(void);\n+extern void read_info_alternates(const char * relative_base, int depth);\n extern void add_to_alternates_file(const char *reference);\n typedef int alt_odb_fn(struct alternate_object_database *, void *);\n extern void foreach_alt_odb(alt_odb_fn, void*);\ndiff --git a/sha1_file.c b/sha1_file.c\nindex 3c4f165..4ccaf7a 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -229,7 +229,6 @@ char *sha1_pack_index_name(const unsigned char *sha1)\n struct alternate_object_database *alt_odb_list;\n static struct alternate_object_database **alt_odb_tail;\n \n-static void read_info_alternates(const char * alternates, int depth);\n static int git_open_noatime(const char *name);\n \n /*\n@@ -354,7 +353,7 @@ static void link_alt_odb_entries(const char *alt, const char *ep, int sep,\n \t}\n }\n \n-static void read_info_alternates(const char * relative_base, int depth)\n+void read_info_alternates(const char * relative_base, int depth)\n {\n \tchar *map;\n \tsize_t mapsz;\ndiff --git a/submodule.c b/submodule.c\nindex 784b580..959d349 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -63,6 +63,9 @@ static int add_submodule_odb(const char *path)\n \talt_odb->name[40] = '\\0';\n \talt_odb->name[41] = '\\0';\n \talt_odb_list = alt_odb;\n+\n+\t/* add possible alternates from the submodule */\n+\tread_info_alternates(objects_directory.buf, 0);\n \tprepare_alt_odb();\n done:\n \tstrbuf_release(&objects_directory);\ndiff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\nindex bf9a752..6c01d0c 100755\n--- a/t/t4041-diff-submodule-option.sh\n+++ b/t/t4041-diff-submodule-option.sh\n@@ -458,4 +458,38 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'diff --submodule with objects referenced by alternates' '\n+\tmkdir sub_alt &&\n+\t(cd sub_alt &&\n+\t\tgit init &&\n+\t\techo a >a &&\n+\t\tgit add a &&\n+\t\tgit commit -m a\n+\t) &&\n+\tmkdir super &&\n+\t(cd super &&\n+\t\tgit clone -s ../sub_alt sub &&\n+\t\tgit init &&\n+\t\tgit add sub &&\n+\t\tgit commit -m \"sub a\"\n+\t) &&\n+\t(cd sub_alt &&\n+\t\tsha1_before=$(git rev-parse --short HEAD)\n+\t\techo b >b &&\n+\t\tgit add b &&\n+\t\tgit commit -m b\n+\t\tsha1_after=$(git rev-parse --short HEAD)\n+\t\techo \"Submodule sub $sha1_before..$sha1_after:\n+  > b\" >../expected\n+\t) &&\n+\t(cd super &&\n+\t\t(cd sub &&\n+\t\t\tgit fetch &&\n+\t\t\tgit checkout origin/master\n+\t\t) &&\n+\t\tgit diff --submodule > ../actual\n+\t)\n+\ttest_cmp expected actual\n+'\n+\n test_done\n-- \n1.7.10.1.488.ga84c0c8\n"},{"id":"191504","messageId":"7v7gweiu7b.fsf@alter.siamese.dyndns.org","threadId":"30470","inReplyTo":"20120513172301.GA58961@book.hvoigt.net","subject":"Re: git-diff-tree does not use alternate objects for submodules","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-14T16:49:28Z","receivedAt":"2012-05-14T16:49:28Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Heiko Voigt <hvoigt@hvoigt.net> writes:\n\n> Here is the simplest approach I could think of (not sure if its maybe\n> too simple). On first sight it seems to work (even if I exchange the\n> absolute path in alternates with a relative one.\n\nConceptually looks very sound and trivially correct as long as the\nobjets_directory.buf is always absolute path (I didn't check, and I do not\noffhand know if read_info_alternates() was designed to work when called\nwith a relative path in relative_base).\n"},{"id":"191511","messageId":"20120514175125.GD58058@book.hvoigt.net","threadId":"30470","inReplyTo":"7v7gweiu7b.fsf@alter.siamese.dyndns.org","subject":"Re: git-diff-tree does not use alternate objects for submodules","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2012-05-14T17:51:26Z","receivedAt":"2012-05-14T17:51:26Z","isPatch":false,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"Hi,\n\nOn Mon, May 14, 2012 at 09:49:28AM -0700, Junio C Hamano wrote:\n> Heiko Voigt <hvoigt@hvoigt.net> writes:\n> \n> > Here is the simplest approach I could think of (not sure if its maybe\n> > too simple). On first sight it seems to work (even if I exchange the\n> > absolute path in alternates with a relative one.\n> \n> Conceptually looks very sound and trivially correct as long as the\n> objets_directory.buf is always absolute path (I didn't check, and I do not\n> offhand know if read_info_alternates() was designed to work when called\n> with a relative path in relative_base).\n\nIt looks quite so:\n\nIn read_info_alternates() the alternates file underneath the passed\nrelative_base is opened. It then passes it on to link_alt_odb_entries()\nwhich itself passes it unmodified to link_alt_odb_entry().\n\nlink_alt_odb_entry() uses realpath to combine relative entries with\nrelative_base before recursively passing the entry to\nread_info_alternates().\n\nFor entries with absolute path relative_base does not seem to be\nrelevant.\n\nCheers Heiko\n"},{"id":"191513","messageId":"7vr4umhc7r.fsf@alter.siamese.dyndns.org","threadId":"30470","inReplyTo":"20120514175125.GD58058@book.hvoigt.net","subject":"Re: git-diff-tree does not use alternate objects for submodules","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-14T18:03:20Z","receivedAt":"2012-05-14T18:03:20Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Heiko Voigt <hvoigt@hvoigt.net> writes:\n\n> link_alt_odb_entry() uses realpath to combine relative entries with\n> relative_base before recursively passing the entry to\n> read_info_alternates().\n>\n> For entries with absolute path relative_base does not seem to be\n> relevant.\n\nI wasn't worried about \"entries with absolute paths\".  I was worried about\nrelative_base that the caller passes may not be absolute but relative to\nsomething (perhaps the processe's getcwd()); it seems that the call to\nreal_path() to turn it into an absolute one at the very beginning of the\nlink_alt_odb_entry() function does indeed take care of that case.\n\nThanks.\n"}]}