git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* dotfiles in git template dir are not copied
@ 2017-02-17  9:31 greg0ire
  2017-02-17 20:44 ` Jeff King
  0 siblings, 1 reply; 12+ messages in thread
From: greg0ire @ 2017-02-17  9:31 UTC (permalink / raw)
  To: git

Hi,

I noticed yesterday that dotfiles inside the directory configured in 
init.templatedir are not copied when creating a new repository.

Here is the line I think is responsible for this behavior : 
https://github.com/git/git/blob/master/builtin/init-db.c#L48

Is it a bug or a feature?

Steps to reproduce, provided you already have a template dir configured :

cd $(git config --path --get init.templatedir)
touch copied
touch .not_copied
cd /tmp
mkdir whatever
cd whatever
git init
ls -la .git

On my machine, the last command does not list .not_copied .

--
greg0ire

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: dotfiles in git template dir are not copied
  2017-02-17  9:31 dotfiles in git template dir are not copied greg0ire
@ 2017-02-17 20:44 ` Jeff King
  2017-02-17 21:42   ` Grégoire PARIS
  0 siblings, 1 reply; 12+ messages in thread
From: Jeff King @ 2017-02-17 20:44 UTC (permalink / raw)
  To: greg0ire; +Cc: git

On Fri, Feb 17, 2017 at 10:31:37AM +0100, greg0ire wrote:

> I noticed yesterday that dotfiles inside the directory configured in
> init.templatedir are not copied when creating a new repository.
> 
> Here is the line I think is responsible for this behavior :
> https://github.com/git/git/blob/master/builtin/init-db.c#L48
> 
> Is it a bug or a feature?

I think it's probably a feature. You could, for example, have your
template directory itself be a git repository. You would not want to
copy the ".git" directory around.

I wouldn't be surprised if the documentation could be improved, though.

-Peff

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: dotfiles in git template dir are not copied
  2017-02-17 20:44 ` Jeff King
@ 2017-02-17 21:42   ` Grégoire PARIS
  2017-02-17 22:12     ` Junio C Hamano
                       ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Grégoire PARIS @ 2017-02-17 21:42 UTC (permalink / raw)
  To: Jeff King; +Cc: git

 > You could, for example, have your template directory itself be a git 
repository.

I can and I do and indeed, that might be the reason behind this.
I made a PR to document this : https://github.com/git/git/pull/325

--
greg0ire

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: dotfiles in git template dir are not copied
  2017-02-17 21:42   ` Grégoire PARIS
@ 2017-02-17 22:12     ` Junio C Hamano
  2017-02-17 22:37       ` Grégoire PARIS
  2017-02-17 22:39     ` Philip Oakley
  2017-02-17 22:56     ` Junio C Hamano
  2 siblings, 1 reply; 12+ messages in thread
From: Junio C Hamano @ 2017-02-17 22:12 UTC (permalink / raw)
  To: Grégoire PARIS; +Cc: Jeff King, git

Grégoire PARIS <postmaster@greg0ire.fr> writes:

>> You could, for example, have your template directory itself be a git 
> repository.
>
> I can and I do and indeed, that might be the reason behind this.

An embedded .git was _not_ the reason behind the current behaviour
when we wrote it.  The primary reason is because we did not ship and
did not plan to ship anything .dot in our standard template set and
there wasn't any reason to copy what we were not going to ever ship
;-).

As a justification after the fact, "you wouldn't want to copy .git
do you?" is a good one, though, and I do not think we should change
the behaviour to copy files whose names begin with a dot.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: dotfiles in git template dir are not copied
  2017-02-17 22:12     ` Junio C Hamano
@ 2017-02-17 22:37       ` Grégoire PARIS
  2017-02-17 22:44         ` Junio C Hamano
  0 siblings, 1 reply; 12+ messages in thread
From: Grégoire PARIS @ 2017-02-17 22:37 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, git

 > I do not think we should change the behaviour
 > to copy files whose names begin with a dot.

So bug turned feature it is :)

I amended my commit message accordingly.

In my case, my template dir is not at the root of the repository where 
it is versioned, so it would not be a problem for me, but I think some 
people might use this feature to add tests/docs without having them copied.

my template dir repository : https://github.com/greg0ire/git_template

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: dotfiles in git template dir are not copied
  2017-02-17 21:42   ` Grégoire PARIS
  2017-02-17 22:12     ` Junio C Hamano
@ 2017-02-17 22:39     ` Philip Oakley
  2017-02-17 22:49       ` Grégoire PARIS
  2017-02-17 22:56     ` Junio C Hamano
  2 siblings, 1 reply; 12+ messages in thread
From: Philip Oakley @ 2017-02-17 22:39 UTC (permalink / raw)
  To: Jeff King, Grégoire PARIS; +Cc: git

From: "Grégoire PARIS" <postmaster@greg0ire.fr>
> > You could, for example, have your template directory itself be a git
> repository.
>
> I can and I do and indeed, that might be the reason behind this.
> I made a PR to document this : https://github.com/git/git/pull/325
>
While the PR is a simple one line change to the documention, the patch 
should be submitted to the list.
See Documenation/SubmittingPatches

Don't forget to Sign Off your patch (see the Developer's Certificate of 
Origin section).
--
Philip 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: dotfiles in git template dir are not copied
  2017-02-17 22:37       ` Grégoire PARIS
@ 2017-02-17 22:44         ` Junio C Hamano
  2017-02-17 23:39           ` Grégoire PARIS
  0 siblings, 1 reply; 12+ messages in thread
From: Junio C Hamano @ 2017-02-17 22:44 UTC (permalink / raw)
  To: Grégoire PARIS; +Cc: Jeff King, git

Grégoire PARIS <postmaster@greg0ire.fr> writes:

>> I do not think we should change the behaviour
>> to copy files whose names begin with a dot.
>
> So bug turned feature it is :)

There was no 'bug' either.  It's just the way it is ;-)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: dotfiles in git template dir are not copied
  2017-02-17 22:39     ` Philip Oakley
@ 2017-02-17 22:49       ` Grégoire PARIS
  0 siblings, 0 replies; 12+ messages in thread
From: Grégoire PARIS @ 2017-02-17 22:49 UTC (permalink / raw)
  To: Philip Oakley, Jeff King; +Cc: git

Le 17/02/2017 à 23:39, Philip Oakley a écrit :
> From: "Grégoire PARIS" <postmaster@greg0ire.fr>
>> > You could, for example, have your template directory itself be a git
>> repository.
>>
>> I can and I do and indeed, that might be the reason behind this.
>> I made a PR to document this : https://github.com/git/git/pull/325
>>
> While the PR is a simple one line change to the documention, the patch 
> should be submitted to the list.
> See Documenation/SubmittingPatches
>
> Don't forget to Sign Off your patch (see the Developer's Certificate 
> of Origin section).
> -- 
> Philip
>
Ok sorry, I'll fix this rightaway!
--
greg0ire

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: dotfiles in git template dir are not copied
  2017-02-17 21:42   ` Grégoire PARIS
  2017-02-17 22:12     ` Junio C Hamano
  2017-02-17 22:39     ` Philip Oakley
@ 2017-02-17 22:56     ` Junio C Hamano
  2017-02-17 23:22       ` Grégoire PARIS
  2 siblings, 1 reply; 12+ messages in thread
From: Junio C Hamano @ 2017-02-17 22:56 UTC (permalink / raw)
  To: Grégoire PARIS; +Cc: Jeff King, git

Grégoire PARIS <postmaster@greg0ire.fr> writes:

>> You could, for example, have your template directory itself be a git 
> repository.
>
> I can and I do and indeed, that might be the reason behind this.
> I made a PR to document this : https://github.com/git/git/pull/325

Let's take a look.

> From: Grégoire PARIS <postmaster@greg0ire.fr>
> Date: Fri, 17 Feb 2017 22:33:40 +0100
> Subject: [PATCH] Document dotfiles exclusion on template copy
> 
> Since there is no dotfile in the default template directory, there was
> no point in making the check for . or .. more accurate when copying. Now
> that you can customize the template directory, it would make sense, but
> it's actually a good thing to at this because you would not want to have
> your git directory copied in every git directory that is created should
> you decide to put your template directory under version control. Plus it
> might be used as a feature by people who would want to exclude some
> files.

OK.

> See https://public-inbox.org/git/20170217204411.2yixhuazgczxmmxa@sigill.intra.peff.net/T/#t

I do not think what was discussed there adds much.  Drop this line.

Instead, add your sign-off (Documentation/SubmittingPatches) here

    Signed-off-by: Grégoire PARIS <postmaster@greg0ire.fr>

> ---
>  Documentation/git-init.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Documentation/git-init.txt b/Documentation/git-init.txt
> index 9d27197de8..e3b185cf86 100644
> --- a/Documentation/git-init.txt
> +++ b/Documentation/git-init.txt
> @@ -117,7 +117,7 @@ TEMPLATE DIRECTORY
>  ------------------
>  
>  The template directory contains files and directories that will be copied to
> -the `$GIT_DIR` after it is created.
> +the `$GIT_DIR` after it is created, unless their name starts with a dot.

"... that will be copied ..., unless they are dot" is not incorrect
per-se, but perhaps rewriting the whole sentence, e.g. "Files and
directories in the template directory whose name do not start with a
dot will be copied to ...", may make it easier to read, I suspect.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: dotfiles in git template dir are not copied
  2017-02-17 22:56     ` Junio C Hamano
@ 2017-02-17 23:22       ` Grégoire PARIS
  2017-02-17 23:30         ` Grégoire PARIS
  0 siblings, 1 reply; 12+ messages in thread
From: Grégoire PARIS @ 2017-02-17 23:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, git

Thanks for your guidance. I believe I just sent the patch to the mailing 
list.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: dotfiles in git template dir are not copied
  2017-02-17 23:22       ` Grégoire PARIS
@ 2017-02-17 23:30         ` Grégoire PARIS
  0 siblings, 0 replies; 12+ messages in thread
From: Grégoire PARIS @ 2017-02-17 23:30 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, git

 > Thanks for your guidance. I believe I just sent the patch to the 
mailing list.

I just retried with the Gmail SMTP, and now I am sure it worked. Sorry 
for the noobery.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: dotfiles in git template dir are not copied
  2017-02-17 22:44         ` Junio C Hamano
@ 2017-02-17 23:39           ` Grégoire PARIS
  0 siblings, 0 replies; 12+ messages in thread
From: Grégoire PARIS @ 2017-02-17 23:39 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, git

 >There was no 'bug' either. It's just the way it is ;-)

Sure !

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-02-17 23:39 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-17  9:31 dotfiles in git template dir are not copied greg0ire
2017-02-17 20:44 ` Jeff King
2017-02-17 21:42   ` Grégoire PARIS
2017-02-17 22:12     ` Junio C Hamano
2017-02-17 22:37       ` Grégoire PARIS
2017-02-17 22:44         ` Junio C Hamano
2017-02-17 23:39           ` Grégoire PARIS
2017-02-17 22:39     ` Philip Oakley
2017-02-17 22:49       ` Grégoire PARIS
2017-02-17 22:56     ` Junio C Hamano
2017-02-17 23:22       ` Grégoire PARIS
2017-02-17 23:30         ` Grégoire PARIS

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).