{"thread":{"id":"708","subject":"Re: git-update-cache: allow dot-files","startedAt":"2005-05-25T00:12:34Z","lastAt":"2005-05-26T09:02:54Z","messageCount":11,"participants":["Junio C Hamano","Linus Torvalds","Petr Baudis"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"3896","messageId":"7vhdgstb7x.fsf@assigned-by-dhcp.cox.net","threadId":"708","inReplyTo":null,"subject":"Re: git-update-cache: allow dot-files","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-05-25T00:12:34Z","receivedAt":"2005-05-25T00:12:34Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus, I think this is wrong.  GIT_DIR could be something other\nthan \".git\".  I'd rather allow everything other than . and .. in\nthe core layer, and have Porcelain layer ignore-paths logic to\ndeal with \"^.git/\" (only when GIT_DIR is .git; otherwise\nignore-path configuration file for that particular tree needs to\nsay what to ignore).\n\n    git-update-cache: allow dot-files\n\n    diff --git a/update-cache.c b/update-cache.c\n    --- a/update-cache.c\n    +++ b/update-cache.c\n    @@ -238,13 +238,42 @@ static int refresh_cache(void)\n\n     /*\n      * We fundamentally don't like some paths: we don't want\n    - * dot or dot-dot anywhere, and in fact, we don't even want\n    - * any other dot-files (.git or anything else). They\n    - * are hidden, for chist sake.\n    + * dot or dot-dot anywhere, and for obvious reasons don't\n    + * want to recurse into \".git\" either.\n      *\n      * Also, we don't want double slashes or slashes at the\n      * end that can make pathnames ambiguous.\n      */\n    +static int verify_dotfile(const char *rest)\n    +{\n    +\t/*\n\n"},{"id":"3898","messageId":"Pine.LNX.4.58.0505241723060.2307@ppc970.osdl.org","threadId":"708","inReplyTo":"7vhdgstb7x.fsf@assigned-by-dhcp.cox.net","subject":"Re: git-update-cache: allow dot-files","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-05-25T00:24:31Z","receivedAt":"2005-05-25T00:24:31Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 24 May 2005, Junio C Hamano wrote:\n>\n> Linus, I think this is wrong.  GIT_DIR could be something other\n> than \".git\".\n\nI considered it, but it's so much easier to allow things later than deny \nthem, that I preferred being anal about it.\n\n\t\t\tLinus\n"},{"id":"3900","messageId":"7v8y24taai.fsf@assigned-by-dhcp.cox.net","threadId":"708","inReplyTo":"Pine.LNX.4.58.0505241723060.2307@ppc970.osdl.org","subject":"Re: git-update-cache: allow dot-files","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-05-25T00:32:37Z","receivedAt":"2005-05-25T00:32:37Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"LT\" == Linus Torvalds <torvalds@osdl.org> writes:\n\nLT> I considered it, but it's so much easier to allow things\nLT> later than deny them, that I preferred being anal about it.\n\nThat is not the point.  GIT_DIR set to \"GIT\" would happily suck\nindex file in.  You are not being anal enough.\n\n"},{"id":"3901","messageId":"7v1x7wt9qm.fsf_-_@assigned-by-dhcp.cox.net","threadId":"708","inReplyTo":"7v8y24taai.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] Allow dot files in ls-files as well.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-05-25T00:44:33Z","receivedAt":"2005-05-25T00:44:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"JCH\" == Junio C Hamano <junkio@cox.net> writes:\n\n>>>>> \"LT\" == Linus Torvalds <torvalds@osdl.org> writes:\nLT> I considered it, but it's so much easier to allow things\nLT> later than deny them, that I preferred being anal about it.\n\nJCH> That is not the point.  GIT_DIR set to \"GIT\" would happily suck\nJCH> index file in.  You are not being anal enough.\n\n... which makes me feel that, since you cannot be anal enough\nanyway, it would be more consistent not to be more restrictive\nthan necessary (the user has every right to screw himself\nanyway).\n\nNo matter what you end up doing, you would need something like\nthis as well (I am not screening .git here but that should be\neasy for you to add).\n\n------------\nAllow dot files in ls-files as well.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\ncd /opt/packrat/playpen/public/in-place/git/git.junio/\nPATH=.:$PATH jit-diff 1: ls-files.c\n# - linus: git-update-cache: allow dot-files\n# + (working tree)\ndiff --git a/ls-files.c b/ls-files.c\n--- a/ls-files.c\n+++ b/ls-files.c\n@@ -136,7 +136,9 @@ static void read_directory(const char *p\n \t\twhile ((de = readdir(dir)) != NULL) {\n \t\t\tint len;\n \n-\t\t\tif (de->d_name[0] == '.')\n+\t\t\tif (de->d_name[0] == '.' &&\n+\t\t\t    (de->d_name[1] == 0 ||\n+\t\t\t     (de->d_name[1] == '.' && de->d_name[2] == 0)))\n \t\t\t\tcontinue;\n \t\t\tif (excluded(de->d_name) != show_ignored)\n \t\t\t\tcontinue;\n\n\n"},{"id":"3903","messageId":"Pine.LNX.4.58.0505241748520.2307@ppc970.osdl.org","threadId":"708","inReplyTo":"7v8y24taai.fsf@assigned-by-dhcp.cox.net","subject":"Re: git-update-cache: allow dot-files","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-05-25T00:52:23Z","receivedAt":"2005-05-25T00:52:23Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 24 May 2005, Junio C Hamano wrote:\n> >>>>> \"LT\" == Linus Torvalds <torvalds@osdl.org> writes:\n> \n> LT> I considered it, but it's so much easier to allow things\n> LT> later than deny them, that I preferred being anal about it.\n> \n> That is not the point.  GIT_DIR set to \"GIT\" would happily suck\n> index file in.  You are not being anal enough.\n\nHeh. There's a difference between being anal, and allowing people to shoot \nthemselves in the foot.\n\nI'll happily allow people who _try_ to do stupid things to do them ;)\n\nIt's the\n\n\tfind . -type f | cut -d/ -f2- | xargs git-update-cache --add --\n\nkinds of \"unintentionally stupid\" scripts I want to avoid (and the reason\nI do that is because that's basically _exactly_ the script I used when\ntesting something ;)\n\n\t\tLinus\n"},{"id":"3904","messageId":"Pine.LNX.4.58.0505241753300.2307@ppc970.osdl.org","threadId":"708","inReplyTo":"7v1x7wt9qm.fsf_-_@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Allow dot files in ls-files as well.","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-05-25T00:54:33Z","receivedAt":"2005-05-25T00:54:33Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 24 May 2005, Junio C Hamano wrote:\n> \n> No matter what you end up doing, you would need something like\n> this as well (I am not screening .git here but that should be\n> easy for you to add).\n\nEhh, this will do bad things for \"git-show-files --others\", no?\n\nYou really _do_ want to strip out the \".git\" file.\n\n\t\tLinus\n"},{"id":"3907","messageId":"7v8y24ru51.fsf@assigned-by-dhcp.cox.net","threadId":"708","inReplyTo":"Pine.LNX.4.58.0505241753300.2307@ppc970.osdl.org","subject":"Re: [PATCH] Allow dot files in ls-files as well.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-05-25T01:06:50Z","receivedAt":"2005-05-25T01:06:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"LT\" == Linus Torvalds <torvalds@osdl.org> writes:\n\nLT> You really _do_ want to strip out the \".git\" file.\n\nYes I do, but not probably hardcoded \".git\".\n\n"},{"id":"3908","messageId":"7v3bscrtwx.fsf@assigned-by-dhcp.cox.net","threadId":"708","inReplyTo":"Pine.LNX.4.58.0505241748520.2307@ppc970.osdl.org","subject":"Re: git-update-cache: allow dot-files","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-05-25T01:11:42Z","receivedAt":"2005-05-25T01:11:42Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"LT\" == Linus Torvalds <torvalds@osdl.org> writes:\n\nLT> Heh. There's a difference between being anal, and allowing people to shoot \nLT> themselves in the foot.\n\nHow about we do something like this:\n\n (1) we keep hardcoded .git refusing as you did;\n (2) we forbid GIT_DIR to be set to anything other than what\n     ends with \"/.git\", unless it is literally \".git\";\n\n\n"},{"id":"3909","messageId":"7vwtpoqeyf.fsf_-_@assigned-by-dhcp.cox.net","threadId":"708","inReplyTo":"Pine.LNX.4.58.0505241753300.2307@ppc970.osdl.org","subject":"[PATCH] Allow dot files in ls-files as well (take #2).","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-05-25T01:20:08Z","receivedAt":"2005-05-25T01:20:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This attempts to match \"the directory '.git' anywhere in the\ntree is ignored\" approach taken in update-cache.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\ncd /opt/packrat/playpen/public/in-place/git/git.junio/\nPATH=.:$PATH jit-diff : ls-files.c\n# - linus: git-update-cache: allow dot-files\n# + (working tree)\ndiff --git a/ls-files.c b/ls-files.c\n--- a/ls-files.c\n+++ b/ls-files.c\n@@ -136,7 +136,10 @@ static void read_directory(const char *p\n \t\twhile ((de = readdir(dir)) != NULL) {\n \t\t\tint len;\n \n-\t\t\tif (de->d_name[0] == '.')\n+\t\t\tif ((de->d_name[0] == '.') &&\n+\t\t\t    (de->d_name[1] == 0 ||\n+\t\t\t     !strcmp(de->d_name + 1, \".\") ||\n+\t\t\t     !strcmp(de->d_name + 1, \"git\")))\n \t\t\t\tcontinue;\n \t\t\tif (excluded(de->d_name) != show_ignored)\n \t\t\t\tcontinue;\n\n\n\n"},{"id":"3979","messageId":"20050526083745.GD22262@pasky.ji.cz","threadId":"708","inReplyTo":"7v3bscrtwx.fsf@assigned-by-dhcp.cox.net","subject":"Re: git-update-cache: allow dot-files","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-05-26T08:37:45Z","receivedAt":"2005-05-26T08:37:45Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Wed, May 25, 2005 at 03:11:42AM CEST, I got a letter\nwhere Junio C Hamano <junkio@cox.net> told me that...\n> >>>>> \"LT\" == Linus Torvalds <torvalds@osdl.org> writes:\n> \n> LT> Heh. There's a difference between being anal, and allowing people to shoot \n> LT> themselves in the foot.\n> \n> How about we do something like this:\n> \n>  (1) we keep hardcoded .git refusing as you did;\n>  (2) we forbid GIT_DIR to be set to anything other than what\n>      ends with \"/.git\", unless it is literally \".git\";\n\nThat doesn't make any sense. When I'm working on kernel.org, why\nwould you prohibit me to set GIT_DIR to /pub/scm/cogito/cogito.git ?\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"3980","messageId":"7vd5ree4w1.fsf@assigned-by-dhcp.cox.net","threadId":"708","inReplyTo":"20050526083745.GD22262@pasky.ji.cz","subject":"Re: git-update-cache: allow dot-files","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-05-26T09:02:54Z","receivedAt":"2005-05-26T09:02:54Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"PB\" == Petr Baudis <pasky@ucw.cz> writes:\n\nPB> That doesn't make any sense. When I'm working on kernel.org, why\nPB> would you prohibit me to set GIT_DIR to /pub/scm/cogito/cogito.git ?\n\nWhat you say makes perfect sense, but avoiding hardcoded \".git/\"\ndoes not make any sense either in that situation.  \n\nAlternative suggestions welcome.\n\n"}]}