Re: git init with template dir

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: git init with template dir

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:05:17

Alex Cornejo [off-list ref] writes:
I was surprised to see that when using git-init, if the template folder
is itself a symlink, then the contents of the template is NOT copied to
the resulting git repository, but instead each individual file is
symlinked.
Hmmm, I do not seem to be able to do this, though.

        $ ln -s $HOME/g/share/git-core/templates /var/tmp/git-template
        $ cd /var/tmp
	$ git init --template=/var/tmp/git-template new
        $ find new/.git -type l
        ... nothing ...
For my particular use case, this is undesirable (since if I am not
careful, then when I change the hook of one git repo, it
actually changes the hooks of all other repos too). It is easy
enough for me to work around this (i.e. by instead pointing my gitconfig
to use a template dir which is not a symlink), but I was
wondering weather this is a feature folks use (and for what end), or if
this is unintended behavior.
That you had to predicate "this is undesireable" with "For my
particular use case" tells me that other people may want to see that
these things shared and automatically receive updates when the
originals in the temporate directory are updated, which makes it
sound like a "feature" not an "unintended behaviour", at least to
me.

Re: git init with template dir

From: Alex Cornejo <hidden>
Date: 2016-06-15 23:05:17

Junio C Hamano <gitster <at> pobox.com> writes:
Hmmm, I do not seem to be able to do this, though.

        $ ln -s $HOME/g/share/git-core/templates /var/tmp/git-template
        $ cd /var/tmp
	$ git init --template=/var/tmp/git-template new
        $ find new/.git -type l
        ... nothing ...
Thanks for your prompt response Juno.

That make sense. The fact that you were unable to reproduce this tells
me that there is probably something fishy/unexpected with the
environment in which I tried this (which is not too surprising, given
that I was doing it inside a linux container, inside a virtual machine,
where both of these were setup using a scripts which ultimately failed
after the git init step, due to the symlink behavior I described, but
most likely this is my own fault). I should have tried to reproduce this
on a clean slate before posting this question.

Thanks again,

Alex
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help