From: Nazri Ramliy <ayiehere@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Eric Sunshine <sunshine@sunshineco.com>,
Git List <git@vger.kernel.org>, Jeff King <peff@peff.net>,
Jonathan Nieder <jrnieder@gmail.com>
Subject: Re: [PATCH v3] Teach git to change to a given directory using -C option
Date: Wed, 4 Sep 2013 14:36:47 +0800 [thread overview]
Message-ID: <CAEY4ZpN4xgt+gJSVeTfDNC--xt3N+M7vVLFBC7FTWBQtjvN8tw@mail.gmail.com> (raw)
In-Reply-To: <xmqq8uzdplqv.fsf@gitster.dls.corp.google.com>
On Wed, Sep 4, 2013 at 6:46 AM, Junio C Hamano <gitster@pobox.com> wrote:
> I do not care too deeply either way, but I am curious if there was a
> reason why you changed the earlier <directory> to <path>? Somehow,
> when we _know_ a path has to be a directory, I find it easier on the
> readers to spell that out, instead of saying "this is a path",
> implying that it could be a directory, a regular file, or even
> non-existent.
Eric made me do it :). Personally I prefer the non-ambiguous "directory"
over "path". In fact, "directory" is used in the error message spat out
by git:
$ git --work-tree
No directory given for --work-tree.
...
$ git --git-dir
No directory given for --git-dir.
...
$
I think changing "<path>" to "<directory>" wherever appropriate in
git.txt would be an improvement. Tangent: <dir> is shorter but that
might not be easy on the translators.
>> +-C <path>::
>> + Run as if git was started in <path> instead of the current working
>> + directory. When multiple -C options are given, each subsequent
>> + non-absolute "-C <path>" is interpreted relative to the preceding "-C
>> + <path>".
>> +
>> + This option affects options that expect path name like --git-dir and
>> + --work-tree in that their interpretations of the path names would be
>> + made relative to the working directory caused by the -C option. For
>> + example the following invocations are equivalent:
>> +
>> + git --git-dir=a.git --work-tree=b -C c status
>> + git --git-dir=c/a.git --work-tree=c/b status
>> +
>
> Does the above format correctly without the usual "second and
> subsequent paragraphs are not indented, but has '+' in place of
> a blank line"?
No it doesn't. I'll fix it in the next reroll.
>> - if (!prefixcmp(cmd, "--exec-path")) {
>> + if (!strcmp(cmd, "-C")) {
>> + if (*argc < 2) {
>> + fprintf(stderr, "No directory given for -C.\n" );
>> + usage(git_usage_string);
>> + }
>> + if (chdir((*argv)[1]))
>> + die_errno("Cannot change to '%s'", (*argv)[1]);
>> + if (envchanged)
>> + *envchanged = 1;
>> + (*argv)++;
>> + (*argc)--;
>> + } else if (!prefixcmp(cmd, "--exec-path")) {
>
> We usually do not prepend to an existing if/else if/ chain unless
> there is a very good reason (e.g. the new "if" condition is very
> often triggered and we are better off checking it early) exactly
> because doing so would make a patch that is ugly like the above.
> You are not touching the codepath that deal with --exec-path, but
> the resulting patch makes it appear as if you are doing something to
> it.
I agree with you here. I'll send the reroll later.
nazri
next prev parent reply other threads:[~2013-09-04 6:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-03 11:59 [PATCH v3] Teach git to change to a given directory using -C option Nazri Ramliy
2013-09-03 22:46 ` Junio C Hamano
2013-09-03 23:37 ` Eric Sunshine
2013-09-04 6:36 ` Nazri Ramliy [this message]
2013-09-04 6:45 ` Eric Sunshine
2013-09-04 12:20 ` Nazri Ramliy
2013-09-08 10:32 ` Eric Sunshine
2013-09-09 1:49 ` Nazri Ramliy
2013-09-09 5:01 ` Eric Sunshine
2013-09-09 13:47 ` Nazri Ramliy
2013-09-09 16:32 ` Junio C Hamano
2013-09-09 17:42 ` Eric Sunshine
2013-09-09 17:59 ` Junio C Hamano
2013-09-09 18:43 ` Eric Sunshine
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAEY4ZpN4xgt+gJSVeTfDNC--xt3N+M7vVLFBC7FTWBQtjvN8tw@mail.gmail.com \
--to=ayiehere@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=peff@peff.net \
--cc=sunshine@sunshineco.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.
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 NNTP newsgroup(s).