git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] init: make --template path relative to $CWD
Date: Mon, 13 May 2019 15:12:55 +0900	[thread overview]
Message-ID: <xmqq5zqedgrc.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20190510104657.26585-1-pclouds@gmail.com> ("Nguyễn Thái Ngọc Duy"'s message of "Fri, 10 May 2019 17:46:57 +0700")

Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> 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 ;-)

      reply	other threads:[~2019-05-13  6:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-10 10:46 [PATCH] init: make --template path relative to $CWD Nguyễn Thái Ngọc Duy
2019-05-13  6:12 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq5zqedgrc.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).