{"thread":{"id":"20621","subject":"\"make quick-install-man\" broke recently","startedAt":"2009-08-17T01:16:54Z","lastAt":"2009-08-17T17:09:10Z","messageCount":13,"participants":["Randal L. Schwartz","Junio C Hamano","Jacob Helwig","Johannes Sixt","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"120808","messageId":"86my5z8cjd.fsf@blue.stonehenge.com","threadId":"20621","inReplyTo":null,"subject":"\"make quick-install-man\" broke recently","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2009-08-17T01:16:54Z","receivedAt":"2009-08-17T01:16:54Z","isPatch":false,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":"\nSomething broke recently in \"make quick-install-man\".  It works\nfine if my mandir is empty, but not if a previous installation\nis there.\n\nPerhaps missing something that deletes the previous values?\n\nOr maybe a change in the way \"git checkout-index\" works?\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nSmalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.\nSee http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion\n"},{"id":"120809","messageId":"7vy6pj449g.fsf@alter.siamese.dyndns.org","threadId":"20621","inReplyTo":"86my5z8cjd.fsf@blue.stonehenge.com","subject":"Re: \"make quick-install-man\" broke recently","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-08-17T01:29:15Z","receivedAt":"2009-08-17T01:29:15Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"merlyn@stonehenge.com (Randal L. Schwartz) writes:\n\n> Something broke recently in \"make quick-install-man\".  It works\n> fine if my mandir is empty, but not if a previous installation\n> is there.\n\nBroken how?\n\nSorry, but I obviously do not use the target myself, because I am the one\nwho builds manpages for real and stuff them in the 'man' branch for you to\ncheck out after all.\n\n\"Something broke\" is bit too vague a problem description if you expect me\nto look into it.\n"},{"id":"120810","messageId":"86iqgn8brv.fsf@blue.stonehenge.com","threadId":"20621","inReplyTo":"7vy6pj449g.fsf@alter.siamese.dyndns.org","subject":"Re: \"make quick-install-man\" broke recently","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2009-08-17T01:33:24Z","receivedAt":"2009-08-17T01:33:24Z","isPatch":false,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":">>>>> \"Junio\" == Junio C Hamano <gitster@pobox.com> writes:\n\nJunio> \"Something broke\" is bit too vague a problem description if you expect\nJunio> me to look into it.\n\nVery sorry.  Let me include some text.\n\n% rm -rf /opt/git/share/man\n% make prefix=/opt/git quick-install-man\nmake -C Documentation quick-install-man\n    SUBDIR ../\nmake[2]: `GIT-VERSION-FILE' is up to date.\n'/bin/sh' ./install-doc-quick.sh origin/man /opt/git/share/man\n% make prefix=/opt/git quick-install-man\nmake -C Documentation quick-install-man\n    SUBDIR ../\nmake[2]: `GIT-VERSION-FILE' is up to date.\n'/bin/sh' ./install-doc-quick.sh origin/man /opt/git/share/man\nerror: git checkout-index: unable to create file /opt/git/share/man/man1/git-add.1 (File exists)\nerror: git checkout-index: unable to create file /opt/git/share/man/man1/git-am.1 (File exists)\nerror: git checkout-index: unable to create file /opt/git/share/man/man1/git-annotate.1 (File exists)\nerror: git checkout-index: unable to create file /opt/git/share/man/man1/git-apply.1 (File exists)\n[...]\n\nSo it fails the second time.  This is new behavior.\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nSmalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.\nSee http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion\n"},{"id":"120823","messageId":"7vd46v3tp1.fsf@alter.siamese.dyndns.org","threadId":"20621","inReplyTo":"86iqgn8brv.fsf@blue.stonehenge.com","subject":"Re: \"make quick-install-man\" broke recently","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-08-17T05:17:30Z","receivedAt":"2009-08-17T05:17:30Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"merlyn@stonehenge.com (Randal L. Schwartz) writes:\n\n> % rm -rf /opt/git/share/man\n> % make prefix=/opt/git quick-install-man\n> make -C Documentation quick-install-man\n>     SUBDIR ../\n> make[2]: `GIT-VERSION-FILE' is up to date.\n> '/bin/sh' ./install-doc-quick.sh origin/man /opt/git/share/man\n> % make prefix=/opt/git quick-install-man\n> make -C Documentation quick-install-man\n>     SUBDIR ../\n> make[2]: `GIT-VERSION-FILE' is up to date.\n> '/bin/sh' ./install-doc-quick.sh origin/man /opt/git/share/man\n> error: git checkout-index: unable to create file /opt/git/share/man/man1/git-add.1 (File exists)\n> error: git checkout-index: unable to create file /opt/git/share/man/man1/git-am.1 (File exists)\n> error: git checkout-index: unable to create file /opt/git/share/man/man1/git-annotate.1 (File exists)\n> error: git checkout-index: unable to create file /opt/git/share/man/man1/git-apply.1 (File exists)\n> [...]\n>\n> So it fails the second time.  This is new behavior.\n\nInteresting, and this does not reproduce for me.  \n\nI've tried \"run twice back to back\" like you did above, \"run once, then\n'find -type f -print | xargs touch' the target, and then run again\", and also\n\"run once, then 'find -type f -print | xargs chmod -w' the target, and then run again\".\n\nNone of these fail.\n\nOne way I can think of to break it deliberately would be:\n\n\tmake prefix=/var/tmp/gomikuzu quick-install-man\n        find /var/tmp/gomikuzu -type d | xargs chmod -w\n\tmake prefix=/var/tmp/gomikuzu quick-install-man\n\nBut then the failure is different from what you showed above:\n\n    error: unable to unlink old '/var/tmp/gomikuzu/share/...' (Permission denied)\n\nPuzzled.\n"},{"id":"120828","messageId":"8c9a060908162258ua50e34ah53c1ada9dbcd4aa0@mail.gmail.com","threadId":"20621","inReplyTo":"7vd46v3tp1.fsf@alter.siamese.dyndns.org","subject":"Re: \"make quick-install-man\" broke recently","fromName":"Jacob Helwig","fromEmail":"jacob.helwig@gmail.com","sentAt":"2009-08-17T05:58:43Z","receivedAt":"2009-08-17T05:58:43Z","isPatch":false,"sender":{"key":"jacob.helwig@gmail.com","avatar":"https://avatars.githubusercontent.com/u/14557?v=4"},"body":"On Sun, Aug 16, 2009 at 22:17, Junio C Hamano<gitster@pobox.com> wrote:\n> merlyn@stonehenge.com (Randal L. Schwartz) writes:\n>\n>> % rm -rf /opt/git/share/man\n>> % make prefix=/opt/git quick-install-man\n>> make -C Documentation quick-install-man\n>>     SUBDIR ../\n>> make[2]: `GIT-VERSION-FILE' is up to date.\n>> '/bin/sh' ./install-doc-quick.sh origin/man /opt/git/share/man\n>> % make prefix=/opt/git quick-install-man\n>> make -C Documentation quick-install-man\n>>     SUBDIR ../\n>> make[2]: `GIT-VERSION-FILE' is up to date.\n>> '/bin/sh' ./install-doc-quick.sh origin/man /opt/git/share/man\n>> error: git checkout-index: unable to create file /opt/git/share/man/man1/git-add.1 (File exists)\n>> error: git checkout-index: unable to create file /opt/git/share/man/man1/git-am.1 (File exists)\n>> error: git checkout-index: unable to create file /opt/git/share/man/man1/git-annotate.1 (File exists)\n>> error: git checkout-index: unable to create file /opt/git/share/man/man1/git-apply.1 (File exists)\n>> [...]\n>>\n>> So it fails the second time.  This is new behavior.\n>\n> Interesting, and this does not reproduce for me.\n>\n> I've tried \"run twice back to back\" like you did above, \"run once, then\n> 'find -type f -print | xargs touch' the target, and then run again\", and also\n> \"run once, then 'find -type f -print | xargs chmod -w' the target, and then run again\".\n>\n> None of these fail.\n>\n> One way I can think of to break it deliberately would be:\n>\n>        make prefix=/var/tmp/gomikuzu quick-install-man\n>        find /var/tmp/gomikuzu -type d | xargs chmod -w\n>        make prefix=/var/tmp/gomikuzu quick-install-man\n>\n> But then the failure is different from what you showed above:\n>\n>    error: unable to unlink old '/var/tmp/gomikuzu/share/...' (Permission denied)\n>\n> Puzzled.\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n\nI was able to reproduce this one one of the machines I have access to,\nand bisecting shows that it was introduced by b6986d8 (git-checkout: be\ncareful about untracked symlinks).  This makes sense, since home-dirs\nare symlinks on the machine I was able to reproduce it on.\n\nHopefully this helps someone with a little stronger fu, to point them in\nthe right direction.\n\nRandal, does your machine have a similar symlinked $HOME setup?\n"},{"id":"120827","messageId":"86ab1z7zdv.fsf@blue.stonehenge.com","threadId":"20621","inReplyTo":"8c9a060908162258ua50e34ah53c1ada9dbcd4aa0@mail.gmail.com","subject":"Re: \"make quick-install-man\" broke recently","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2009-08-17T06:01:00Z","receivedAt":"2009-08-17T06:01:00Z","isPatch":false,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":">>>>> \"Jacob\" == Jacob Helwig <jacob.helwig@gmail.com> writes:\n\nJacob> Randal, does your machine have a similar symlinked $HOME setup?\n\n/opt/git is through two symlinks, yes.\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nSmalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.\nSee http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion\n"},{"id":"120834","messageId":"7vhbw72ap3.fsf@alter.siamese.dyndns.org","threadId":"20621","inReplyTo":"8c9a060908162258ua50e34ah53c1ada9dbcd4aa0@mail.gmail.com","subject":"Re: \"make quick-install-man\" broke recently","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-08-17T06:53:12Z","receivedAt":"2009-08-17T06:53:12Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jacob Helwig <jacob.helwig@gmail.com> writes:\n\n> I was able to reproduce this one one of the machines I have access to,\n> and bisecting shows that it was introduced by b6986d8 (git-checkout: be\n> careful about untracked symlinks).\n\nAhh..\n\n-- >8 --\ncheck_path(): allow symlinked directories to checkout-index --prefix\n\nMerlyn noticed that Documentation/install-doc-quick.sh no longer correctly\nremoves old installed documents when the target directory has a leading\npath that is a symlink.  It turns out that \"checkout-index --prefix\" was\nbroken by recent b6986d8 (git-checkout: be careful about untracked\nsymlinks, 2009-07-29).\n\nI suspect has_symlink_leading_path() could learn the third parameter\n(prefix that is allowed to be symlinked directories) to allow us to retire\na similar function has_dirs_only_path().\n\nAnother avenue of fixing this I considered was to get rid of base_dir and\nbase_dir_len from \"struct checkout\", and instead make \"git checkout-index\"\nwhen run with --prefix mkdir the leading path and chdir in there.  It\nmight be the best longer term solution to this issue, as the base_dir\nfeature is used only by that rather obscure codepath as far as I know.\n\nBut at least this patch should fix this breakage.\n\nSIgned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n cache.h                         |    3 ---\n entry.c                         |   15 ++++++++++++---\n t/t2000-checkout-cache-clash.sh |    9 +++++++++\n 3 files changed, 21 insertions(+), 6 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 9222774..e6c7f33 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -468,9 +468,6 @@ extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_obje\n extern int index_path(unsigned char *sha1, const char *path, struct stat *st, int write_object);\n extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);\n \n-/* \"careful lstat()\" */\n-extern int check_path(const char *path, int len, struct stat *st);\n-\n #define REFRESH_REALLY\t\t0x0001\t/* ignore_valid */\n #define REFRESH_UNMERGED\t0x0002\t/* allow unmerged */\n #define REFRESH_QUIET\t\t0x0004\t/* be quiet about it */\ndiff --git a/entry.c b/entry.c\nindex f276cf3..6813f8a 100644\n--- a/entry.c\n+++ b/entry.c\n@@ -179,9 +179,18 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout\n  * This is like 'lstat()', except it refuses to follow symlinks\n  * in the path.\n  */\n-int check_path(const char *path, int len, struct stat *st)\n+static int check_path(const char *path, int len, struct stat *st,\n+\t\t      const struct checkout *co)\n {\n-\tif (has_symlink_leading_path(path, len)) {\n+\tif (co->base_dir_len) {\n+\t\tconst char *slash = path + len;\n+\t\twhile (path < slash && *slash != '/')\n+\t\t\tslash--;\n+\t\tif (!has_dirs_only_path(path, slash-path, co->base_dir_len)) {\n+\t\t\terrno = ENOENT;\n+\t\t\treturn -1;\n+\t\t}\n+\t} else if (has_symlink_leading_path(path, len)) {\n \t\terrno = ENOENT;\n \t\treturn -1;\n \t}\n@@ -201,7 +210,7 @@ int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *t\n \tstrcpy(path + len, ce->name);\n \tlen += ce_namelen(ce);\n \n-\tif (!check_path(path, len, &st)) {\n+\tif (!check_path(path, len, &st, state)) {\n \t\tunsigned changed = ce_match_stat(ce, &st, CE_MATCH_IGNORE_VALID);\n \t\tif (!changed)\n \t\t\treturn 0;\ndiff --git a/t/t2000-checkout-cache-clash.sh b/t/t2000-checkout-cache-clash.sh\nindex f7e1a73..3edade0 100755\n--- a/t/t2000-checkout-cache-clash.sh\n+++ b/t/t2000-checkout-cache-clash.sh\n@@ -48,4 +48,13 @@ test_expect_success \\\n     'git checkout-index conflicting paths.' \\\n     'test -f path0 && test -d path1 && test -f path1/file1'\n \n+test_expect_success 'checkout-index -f twice with --prefix' '\n+\tmkdir -p tar/get &&\n+\tln -s tar/get there &&\n+\techo first &&\n+\tgit checkout-index -a -f --prefix=there/ &&\n+\techo second &&\n+\tgit checkout-index -a -f --prefix=there/\n+'\n+\n test_done\n"},{"id":"120842","messageId":"4A890E09.9010507@viscovery.net","threadId":"20621","inReplyTo":"7vhbw72ap3.fsf@alter.siamese.dyndns.org","subject":"Re: \"make quick-install-man\" broke recently","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-08-17T08:00:09Z","receivedAt":"2009-08-17T08:00:09Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Junio C Hamano schrieb:\n> check_path(): allow symlinked directories to checkout-index --prefix\n\n> +test_expect_success 'checkout-index -f twice with --prefix' '\n\nPlease add SYMLINKS prerequisite before you publish this test case.\n\n> +\tmkdir -p tar/get &&\n> +\tln -s tar/get there &&\n> +\techo first &&\n> +\tgit checkout-index -a -f --prefix=there/ &&\n> +\techo second &&\n> +\tgit checkout-index -a -f --prefix=there/\n> +'\n\nThanks,\n-- Hannes\n"},{"id":"120843","messageId":"7veira27hq.fsf@alter.siamese.dyndns.org","threadId":"20621","inReplyTo":"4A890E09.9010507@viscovery.net","subject":"Re: \"make quick-install-man\" broke recently","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-08-17T08:02:25Z","receivedAt":"2009-08-17T08:02:25Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> Junio C Hamano schrieb:\n>> check_path(): allow symlinked directories to checkout-index --prefix\n>\n>> +test_expect_success 'checkout-index -f twice with --prefix' '\n>\n> Please add SYMLINKS prerequisite before you publish this test case.\n>\n>> +\tmkdir -p tar/get &&\n>> +\tln -s tar/get there &&\n>> +\techo first &&\n>> +\tgit checkout-index -a -f --prefix=there/ &&\n>> +\techo second &&\n>> +\tgit checkout-index -a -f --prefix=there/\n>> +'\n\nHeh, I am not sure if the fix is the best approach to begin with yet ;-)\n"},{"id":"120892","messageId":"861vna8qj6.fsf@blue.stonehenge.com","threadId":"20621","inReplyTo":"7vhbw72ap3.fsf@alter.siamese.dyndns.org","subject":"Re: \"make quick-install-man\" broke recently","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2009-08-17T14:26:53Z","receivedAt":"2009-08-17T14:26:53Z","isPatch":false,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":">>>>> \"Junio\" == Junio C Hamano <gitster@pobox.com> writes:\n\nJunio> Merlyn noticed that Documentation/install-doc-quick.sh no longer correctly\nJunio> removes old installed documents when the target directory has a leading\nJunio> path that is a symlink.  It turns out that \"checkout-index --prefix\" was\nJunio> broken by recent b6986d8 (git-checkout: be careful about untracked\nJunio> symlinks, 2009-07-29).\n\nIt's good to know I wasn't hallucinating, in any case. :)\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nSmalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.\nSee http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion\n"},{"id":"120906","messageId":"7vhbw6xwk9.fsf@alter.siamese.dyndns.org","threadId":"20621","inReplyTo":"861vna8qj6.fsf@blue.stonehenge.com","subject":"Re: \"make quick-install-man\" broke recently","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-08-17T15:57:26Z","receivedAt":"2009-08-17T15:57:26Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"merlyn@stonehenge.com (Randal L. Schwartz) writes:\n\n> It's good to know I wasn't hallucinating, in any case. :)\n\nThanks.\n"},{"id":"120928","messageId":"alpine.LFD.2.01.0908170932390.3162@localhost.localdomain","threadId":"20621","inReplyTo":"7vhbw72ap3.fsf@alter.siamese.dyndns.org","subject":"Re: \"make quick-install-man\" broke recently","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2009-08-17T16:34:23Z","receivedAt":"2009-08-17T16:34:23Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sun, 16 Aug 2009, Junio C Hamano wrote:\n>\n> -/* \"careful lstat()\" */\n> -extern int check_path(const char *path, int len, struct stat *st);\n> -\n>  #define REFRESH_REALLY\t\t0x0001\t/* ignore_valid */\n>  #define REFRESH_UNMERGED\t0x0002\t/* allow unmerged */\n>  #define REFRESH_QUIET\t\t0x0004\t/* be quiet about it */\n> diff --git a/entry.c b/entry.c\n> index f276cf3..6813f8a 100644\n> --- a/entry.c\n> +++ b/entry.c\n> @@ -179,9 +179,18 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout\n>   * This is like 'lstat()', except it refuses to follow symlinks\n>   * in the path.\n>   */\n> -int check_path(const char *path, int len, struct stat *st)\n> +static int check_path(const char *path, int len, struct stat *st,\n> +\t\t      const struct checkout *co)\n>  {\n> -\tif (has_symlink_leading_path(path, len)) {\n> +\tif (co->base_dir_len) {\n> +\t\tconst char *slash = path + len;\n> +\t\twhile (path < slash && *slash != '/')\n> +\t\t\tslash--;\n> +\t\tif (!has_dirs_only_path(path, slash-path, co->base_dir_len)) {\n> +\t\t\terrno = ENOENT;\n> +\t\t\treturn -1;\n> +\t\t}\n> +\t} else if (has_symlink_leading_path(path, len)) {\n\nGrr. Now 'check_path()' is no longer something generically useful.\n\nCould you perhaps instead only change 'checkout_entry()' to do this hack, \nand leave 'check_path()' as a generic replacement for \"lstat()\" that \ndoesn't follow symlinks?\n\n\t\tLinus\n"},{"id":"120941","messageId":"7vhbw6weo9.fsf@alter.siamese.dyndns.org","threadId":"20621","inReplyTo":"alpine.LFD.2.01.0908170932390.3162@localhost.localdomain","subject":"Re: \"make quick-install-man\" broke recently","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-08-17T17:09:10Z","receivedAt":"2009-08-17T17:09:10Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@linux-foundation.org> writes:\n\n> Grr. Now 'check_path()' is no longer something generically useful.\n>\n> Could you perhaps instead only change 'checkout_entry()' to do this hack, \n> and leave 'check_path()' as a generic replacement for \"lstat()\" that \n> doesn't follow symlinks?\n\nGiven that non-empty base_dir is only used for \"checkout-index --prefix\",\niow, the \"path\" internally used by git and fed to our symlink.c cache are\nsupposed to be always relative to the work tree, I think that may be a\ngood thing to do in the short-term.\n\nBut only if we won't add any more like \"checkout-index --prefix\".  If you\nwant to implement \"git checkout --prefix=over-there/\" and if you want to\ncall check_path() directly (iow not as a part of callchain from\ncheckout_entry()) while doing so, for example, you would regret keeping\nthe check_path() function unaware of base_dir, as you would reintroduce\nthe same bug.\n\nI thought about getting rid of base_dir from struct checkout by running\ncreate_directories() in checkout-index and chdir(2) there, because this is\na very special case codepath anyway.  I actually haven't tried it, but it\nprobably will have bad interactions with the way we find $GIT_DIR.\n"}]}