From: Jonathan Nieder <jrnieder@gmail.com>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: Junio C Hamano <gitster@pobox.com>,
Nguyen Thai Ngoc Duy <pclouds@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH 2/2] t/README: hint about using $(pwd) rather than $PWD in tests
Date: Tue, 11 Jan 2011 02:37:29 -0600 [thread overview]
Message-ID: <20110111083729.GD9445@burratino> (raw)
In-Reply-To: <4D2C11A5.4050709@viscovery.net>
Johannes Sixt wrote:
> Am 1/11/2011 8:54, schrieb Jonathan Nieder:
>> Perhaps it is also worth explaining the cases where $PWD is needed?
>>
>> By contrast, when a passing a path to git or constructing a URL,
>> use $PWD.
>
> The first part of the "or" is not true: you can pass the result of $(pwd)
> to a command, and it means the same as $PWD; I would even recommend
> against $PWD so that a reader does not have to wonder "why pass $PWD, but
> check for $(pwd)?"
I _think_ that passing $PWD always gives the right result. By
contrast, constructions like
PATH=$(pwd)/bin:$PATH
break iirc.
I suspect that the reader will end up wondering "why does this have to
be so complicated" no matter what.
> The second part I don't know whether it is true: I haven't noticed a
> pattern where people did it the wrong way, therefore, I'don't even know
> whether $PWD is really *always* required. Do *you* know?
24f1136 is one example. I don't know of any utility that treats
file://c:/foo/bar/baz
as a URL representing a resource on localhost (and msys bash has no
rewriting rule for it), so in that particular case
(file://$directory), $PWD really does seem to be always required.
>> It makes a difference on Windows, where
>>
>> - $(pwd) is a Windows-style path such as git might output, and
>> - $PWD is a Unix-style path that the shell (MSYS bash) will
>> mangle before passing to native apps like git.
>
> This information is already included by reference to 4114156ae9.
... but if we can summarize it nicely, we can save the reader a
step, no?
Anyway, what you have already written is useful; clearing up these
details would just be icing on the top.
next prev parent reply other threads:[~2011-01-11 8:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <201012302205.13728.j6t@kdbg.org>
2010-12-31 13:00 ` [PATCH] Fix expected values of setup tests on Windows Nguyen Thai Ngoc Duy
2010-12-31 16:11 ` Johannes Sixt
2010-12-31 20:30 ` Jonathan Nieder
2010-12-31 22:21 ` Johannes Sixt
2011-01-02 1:31 ` Junio C Hamano
[not found] ` <4D2C09D7.3070700@viscovery.net>
2011-01-11 7:44 ` [PATCH 2/2] t/README: hint about using $(pwd) rather than $PWD in tests Johannes Sixt
2011-01-11 7:54 ` Jonathan Nieder
2011-01-11 8:15 ` Johannes Sixt
2011-01-11 8:37 ` Jonathan Nieder [this message]
2011-01-11 8:54 ` Johannes Sixt
2011-01-11 17:47 ` Junio C Hamano
2011-01-01 3:46 ` [PATCH] Fix expected values of setup tests on Windows Nguyen Thai Ngoc Duy
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=20110111083729.GD9445@burratino \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j.sixt@viscovery.net \
--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.
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).