Thread (11 messages) 11 messages, 3 authors, 2022-09-22

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

From: Jeff King <hidden>
Date: 2022-09-22 06:18:10

On Thu, Sep 22, 2022 at 01:58:36AM -0400, Eric Sunshine wrote:
quoted
diff --git a/t/t5606-clone-options.sh b/t/t5606-clone-options.sh
@@ -42,11 +42,12 @@ test_expect_success 'rejects invalid -o/--origin' '
+test_expect_success 'clone --bare -o' '
+       git clone -o foo --bare parent clone-bare-o &&
+       (cd parent && pwd) >expect &&
+       git -C clone-bare-o config remote.foo.url >actual &&
+       test_cmp expect actual
 '
Is this safe on Microsoft Windows? My understanding from t/README:

    When a test checks for an absolute path that a git command
    generated, construct the expected value using $(pwd) rather than
    $PWD, $TEST_DIRECTORY, or $TRASH_DIRECTORY. It makes a difference
    on Windows, where the shell (MSYS bash) mangles absolute path
    names. For details, see the commit message of 4114156ae9.

was that you should use $(pwd) rather than raw `pwd` when comparing
against a path generated by Git. Is there a gap in my understanding
here?
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?

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help