{"thread":{"id":"45161","subject":"dotfiles in git template dir are not copied","startedAt":"2017-02-17T13:10:59Z","lastAt":"2017-02-17T23:39:53Z","messageCount":12,"participants":["greg0ire","Jeff King","Grégoire PARIS","Junio C Hamano","Philip Oakley"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"311858","messageId":"ebd661c3-7d99-54d2-dda9-09c4a76cfe93@greg0ire.fr","threadId":"45161","inReplyTo":null,"subject":"dotfiles in git template dir are not copied","fromName":"greg0ire","fromEmail":"postmaster@greg0ire.fr","sentAt":"2017-02-17T09:31:37Z","receivedAt":"2017-02-17T13:10:59Z","isPatch":false,"sender":{"key":"postmaster@greg0ire.fr","avatar":"https://avatars.githubusercontent.com/u/657779?v=4"},"body":"Hi,\n\nI noticed yesterday that dotfiles inside the directory configured in \ninit.templatedir are not copied when creating a new repository.\n\nHere is the line I think is responsible for this behavior : \nhttps://github.com/git/git/blob/master/builtin/init-db.c#L48\n\nIs it a bug or a feature?\n\nSteps to reproduce, provided you already have a template dir configured :\n\ncd $(git config --path --get init.templatedir)\ntouch copied\ntouch .not_copied\ncd /tmp\nmkdir whatever\ncd whatever\ngit init\nls -la .git\n\nOn my machine, the last command does not list .not_copied .\n\n--\ngreg0ire\n"},{"id":"311933","messageId":"20170217204411.2yixhuazgczxmmxa@sigill.intra.peff.net","threadId":"45161","inReplyTo":"ebd661c3-7d99-54d2-dda9-09c4a76cfe93@greg0ire.fr","subject":"Re: dotfiles in git template dir are not copied","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-02-17T20:44:11Z","receivedAt":"2017-02-17T20:44:24Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Feb 17, 2017 at 10:31:37AM +0100, greg0ire wrote:\n\n> I noticed yesterday that dotfiles inside the directory configured in\n> init.templatedir are not copied when creating a new repository.\n> \n> Here is the line I think is responsible for this behavior :\n> https://github.com/git/git/blob/master/builtin/init-db.c#L48\n> \n> Is it a bug or a feature?\n\nI think it's probably a feature. You could, for example, have your\ntemplate directory itself be a git repository. You would not want to\ncopy the \".git\" directory around.\n\nI wouldn't be surprised if the documentation could be improved, though.\n\n-Peff\n"},{"id":"311942","messageId":"2bae8d8a-f0bf-fa8b-8ce4-6880d3490b43@greg0ire.fr","threadId":"45161","inReplyTo":"20170217204411.2yixhuazgczxmmxa@sigill.intra.peff.net","subject":"Re: Re: dotfiles in git template dir are not copied","fromName":"Grégoire PARIS","fromEmail":"postmaster@greg0ire.fr","sentAt":"2017-02-17T21:42:43Z","receivedAt":"2017-02-17T21:51:09Z","isPatch":false,"sender":{"key":"postmaster@greg0ire.fr","avatar":"https://avatars.githubusercontent.com/u/657779?v=4"},"body":" > You could, for example, have your template directory itself be a git \nrepository.\n\nI can and I do and indeed, that might be the reason behind this.\nI made a PR to document this : https://github.com/git/git/pull/325\n\n--\ngreg0ire\n"},{"id":"311945","messageId":"xmqqmvdkqxfd.fsf@gitster.mtv.corp.google.com","threadId":"45161","inReplyTo":"2bae8d8a-f0bf-fa8b-8ce4-6880d3490b43@greg0ire.fr","subject":"Re: dotfiles in git template dir are not copied","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-02-17T22:12:22Z","receivedAt":"2017-02-17T22:12:30Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Grégoire PARIS <postmaster@greg0ire.fr> writes:\n\n>> You could, for example, have your template directory itself be a git \n> repository.\n>\n> I can and I do and indeed, that might be the reason behind this.\n\nAn embedded .git was _not_ the reason behind the current behaviour\nwhen we wrote it.  The primary reason is because we did not ship and\ndid not plan to ship anything .dot in our standard template set and\nthere wasn't any reason to copy what we were not going to ever ship\n;-).\n\nAs a justification after the fact, \"you wouldn't want to copy .git\ndo you?\" is a good one, though, and I do not think we should change\nthe behaviour to copy files whose names begin with a dot.\n\n\n"},{"id":"311955","messageId":"9894f34a-d362-7741-b5b8-3743fe8f4e0b@greg0ire.fr","threadId":"45161","inReplyTo":"xmqqmvdkqxfd.fsf@gitster.mtv.corp.google.com","subject":"Re: dotfiles in git template dir are not copied","fromName":"Grégoire PARIS","fromEmail":"postmaster@greg0ire.fr","sentAt":"2017-02-17T22:37:24Z","receivedAt":"2017-02-17T22:37:36Z","isPatch":false,"sender":{"key":"postmaster@greg0ire.fr","avatar":"https://avatars.githubusercontent.com/u/657779?v=4"},"body":" > I do not think we should change the behaviour\n > to copy files whose names begin with a dot.\n\nSo bug turned feature it is :)\n\nI amended my commit message accordingly.\n\nIn my case, my template dir is not at the root of the repository where \nit is versioned, so it would not be a problem for me, but I think some \npeople might use this feature to add tests/docs without having them copied.\n\nmy template dir repository : https://github.com/greg0ire/git_template\n"},{"id":"311956","messageId":"0C79F8D069F240A6A2C5BF7D7243122F@PhilipOakley","threadId":"45161","inReplyTo":"2bae8d8a-f0bf-fa8b-8ce4-6880d3490b43@greg0ire.fr","subject":"Re: Re: dotfiles in git template dir are not copied","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":null,"receivedAt":"2017-02-17T22:39:09Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"From: \"Grégoire PARIS\" <postmaster@greg0ire.fr>\n> > You could, for example, have your template directory itself be a git\n> repository.\n>\n> I can and I do and indeed, that might be the reason behind this.\n> I made a PR to document this : https://github.com/git/git/pull/325\n>\nWhile the PR is a simple one line change to the documention, the patch \nshould be submitted to the list.\nSee Documenation/SubmittingPatches\n\nDon't forget to Sign Off your patch (see the Developer's Certificate of \nOrigin section).\n--\nPhilip \n\n"},{"id":"311965","messageId":"38a843d6-4755-cc0b-011b-62e3378ddb59@greg0ire.fr","threadId":"45161","inReplyTo":"0C79F8D069F240A6A2C5BF7D7243122F@PhilipOakley","subject":"Re: dotfiles in git template dir are not copied","fromName":"Grégoire PARIS","fromEmail":"postmaster@greg0ire.fr","sentAt":"2017-02-17T22:49:08Z","receivedAt":"2017-02-17T22:49:21Z","isPatch":false,"sender":{"key":"postmaster@greg0ire.fr","avatar":"https://avatars.githubusercontent.com/u/657779?v=4"},"body":"Le 17/02/2017 à 23:39, Philip Oakley a écrit :\n> From: \"Grégoire PARIS\" <postmaster@greg0ire.fr>\n>> > You could, for example, have your template directory itself be a git\n>> repository.\n>>\n>> I can and I do and indeed, that might be the reason behind this.\n>> I made a PR to document this : https://github.com/git/git/pull/325\n>>\n> While the PR is a simple one line change to the documention, the patch \n> should be submitted to the list.\n> See Documenation/SubmittingPatches\n>\n> Don't forget to Sign Off your patch (see the Developer's Certificate \n> of Origin section).\n> -- \n> Philip\n>\nOk sorry, I'll fix this rightaway!\n--\ngreg0ire\n"},{"id":"311966","messageId":"xmqqvas8phdl.fsf@gitster.mtv.corp.google.com","threadId":"45161","inReplyTo":"9894f34a-d362-7741-b5b8-3743fe8f4e0b@greg0ire.fr","subject":"Re: dotfiles in git template dir are not copied","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-02-17T22:44:22Z","receivedAt":"2017-02-17T22:53:25Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Grégoire PARIS <postmaster@greg0ire.fr> writes:\n\n>> I do not think we should change the behaviour\n>> to copy files whose names begin with a dot.\n>\n> So bug turned feature it is :)\n\nThere was no 'bug' either.  It's just the way it is ;-)\n"},{"id":"311967","messageId":"xmqqk28opgsy.fsf@gitster.mtv.corp.google.com","threadId":"45161","inReplyTo":"2bae8d8a-f0bf-fa8b-8ce4-6880d3490b43@greg0ire.fr","subject":"Re: dotfiles in git template dir are not copied","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-02-17T22:56:45Z","receivedAt":"2017-02-17T22:56:57Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Grégoire PARIS <postmaster@greg0ire.fr> writes:\n\n>> You could, for example, have your template directory itself be a git \n> repository.\n>\n> I can and I do and indeed, that might be the reason behind this.\n> I made a PR to document this : https://github.com/git/git/pull/325\n\nLet's take a look.\n\n> From: Grégoire PARIS <postmaster@greg0ire.fr>\n> Date: Fri, 17 Feb 2017 22:33:40 +0100\n> Subject: [PATCH] Document dotfiles exclusion on template copy\n> \n> Since there is no dotfile in the default template directory, there was\n> no point in making the check for . or .. more accurate when copying. Now\n> that you can customize the template directory, it would make sense, but\n> it's actually a good thing to at this because you would not want to have\n> your git directory copied in every git directory that is created should\n> you decide to put your template directory under version control. Plus it\n> might be used as a feature by people who would want to exclude some\n> files.\n\nOK.\n\n> See https://public-inbox.org/git/20170217204411.2yixhuazgczxmmxa@sigill.intra.peff.net/T/#t\n\nI do not think what was discussed there adds much.  Drop this line.\n\nInstead, add your sign-off (Documentation/SubmittingPatches) here\n\n    Signed-off-by: Grégoire PARIS <postmaster@greg0ire.fr>\n\n> ---\n>  Documentation/git-init.txt | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/Documentation/git-init.txt b/Documentation/git-init.txt\n> index 9d27197de8..e3b185cf86 100644\n> --- a/Documentation/git-init.txt\n> +++ b/Documentation/git-init.txt\n> @@ -117,7 +117,7 @@ TEMPLATE DIRECTORY\n>  ------------------\n>  \n>  The template directory contains files and directories that will be copied to\n> -the `$GIT_DIR` after it is created.\n> +the `$GIT_DIR` after it is created, unless their name starts with a dot.\n\n\"... that will be copied ..., unless they are dot\" is not incorrect\nper-se, but perhaps rewriting the whole sentence, e.g. \"Files and\ndirectories in the template directory whose name do not start with a\ndot will be copied to ...\", may make it easier to read, I suspect.\n"},{"id":"311977","messageId":"32094790-1c2b-bc2a-bfde-a101b18945d7@greg0ire.fr","threadId":"45161","inReplyTo":"xmqqk28opgsy.fsf@gitster.mtv.corp.google.com","subject":"Re: dotfiles in git template dir are not copied","fromName":"Grégoire PARIS","fromEmail":"postmaster@greg0ire.fr","sentAt":"2017-02-17T23:22:05Z","receivedAt":"2017-02-17T23:23:00Z","isPatch":false,"sender":{"key":"postmaster@greg0ire.fr","avatar":"https://avatars.githubusercontent.com/u/657779?v=4"},"body":"Thanks for your guidance. I believe I just sent the patch to the mailing \nlist.\n\n\n"},{"id":"311979","messageId":"c0d36fce-960e-aa3f-5b44-5fa899e4d922@greg0ire.fr","threadId":"45161","inReplyTo":"32094790-1c2b-bc2a-bfde-a101b18945d7@greg0ire.fr","subject":"Re: dotfiles in git template dir are not copied","fromName":"Grégoire PARIS","fromEmail":"postmaster@greg0ire.fr","sentAt":"2017-02-17T23:30:43Z","receivedAt":"2017-02-17T23:30:49Z","isPatch":false,"sender":{"key":"postmaster@greg0ire.fr","avatar":"https://avatars.githubusercontent.com/u/657779?v=4"},"body":" > Thanks for your guidance. I believe I just sent the patch to the \nmailing list.\n\nI just retried with the Gmail SMTP, and now I am sure it worked. Sorry \nfor the noobery.\n\n\n"},{"id":"311983","messageId":"b35655c4-fefc-33e3-71c1-b9be741dc98b@greg0ire.fr","threadId":"45161","inReplyTo":"xmqqvas8phdl.fsf@gitster.mtv.corp.google.com","subject":"Re: dotfiles in git template dir are not copied","fromName":"Grégoire PARIS","fromEmail":"postmaster@greg0ire.fr","sentAt":"2017-02-17T23:39:47Z","receivedAt":"2017-02-17T23:39:53Z","isPatch":false,"sender":{"key":"postmaster@greg0ire.fr","avatar":"https://avatars.githubusercontent.com/u/657779?v=4"},"body":" >There was no 'bug' either. It's just the way it is ;-)\n\nSure !\n"}]}