Re: [PATCH 1/2] clone: allow "--bare" with "-o"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 22, 2022 at 02:26:09AM -0400, Eric Sunshine wrote:

> > I think you might be mis-reading the advice here. It is saying to use
> > the "pwd" program, rather than relying on the shell's $PWD variable. So
> > $(pwd) and `pwd` are the same thing (and are what I'm using). The $() I
> > think is just indicating that you'd do:
> >
> >   foo=$(pwd)
> >
> > And yes, I think this is a case where using the right one is important
> > (which is why I used the pwd program, and not $pwd in the test).
> >
> > Or am I missing something else?
> 
> I was thinking, in particular, about this snippet from t/test-lib.sh:
> 
>     # git sees Windows-style pwd
>     pwd () {
>         builtin pwd -W
>     }
> 
> If that's inherited by the subshell used in the test, then I suppose
> all is okay, though I think it would not be inherited.

I think it's OK. $() is itself a subshell, and you can find many calls
to FOO=$(pwd) or similar. And in general, functions are inherited in
subshells:

  $ sh -c 'foo() { echo bar; }; (cd .. && foo)'
  bar

They'd have to be or many things in our test suite would break, since we
use test_must_fail, etc, inside subshells.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux