Thread (1 message) 1 message, 1 author, 2019-05-13

Re: [PATCH] init: make --template path relative to $CWD

From: Junio C Hamano <hidden>
Date: 2019-05-13 06:12:58

Nguyễn Thái Ngọc Duy  [off-list ref] writes:
During git-init we chdir() to the target directory, but --template is
not adjusted. So it's relative to the target directory instead of
current directory.
It would be ok if it's documented, but --template in git-init.txt
mentions nothing about this behavior. Change it to be relative to $CWD,
which is much more intuitive.

The changes in the test suite show that this relative-to-target behavior
is actually used. I just hope that it's only used in the test suite and
it's safe to change. Otherwise, the other option is just document
it (i.e. relative to target dir) and move on.
Yeah, that other option does sound safer, but ...
 	mkdir template-source &&
 	echo content >template-source/file &&
-	git init --template=../template-source template-custom &&
+	git init --template=template-source template-custom &&
... the example may show that the updated behaviour may match the
end-user expectation better.  It certainly is more in line with how
the "--reference" option of "git clone" uses a relative path.

It also makes it easier to <TAB> complete if these things were
relative to the current directory at the time of command
invocation.  I often find it frustrating when I have to create a
symbolic link in a directory I am not yet in that points to
somewhere using a relative path for the exact reason ;-)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help