public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Ben Knoble <ben.knoble@gmail•com>
To: Johannes Sixt <j6t@kdbg•org>
Cc: "D. Ben Knoble" <ben.knoble+github@gmail•com>,
	Junio C Hamano <gitster@pobox•com>,
	Noah Pendleton <noah.pendleton@gmail•com>,
	Patrick Steinhardt <ps@pks•im>,
	Phillip Wood <phillip.wood123@gmail•com>,
	Thranur Andul <thranur@gmail•com>,
	Michael Grosser <grosser.michael@gmail•com>,
	Eric Sunshine <sunshine@sunshineco•com>,
	git@vger•kernel.org
Subject: Re: [PATCH] t7500: fix tests with absolute path following ":(optional)" on Windows
Date: Mon, 20 Oct 2025 09:43:55 -0400	[thread overview]
Message-ID: <A563E028-19E7-48A0-B538-82ACE821DB67@gmail.com> (raw)
In-Reply-To: <6a83c7d1-7cd4-432e-a0ab-7b18ce3af08d@kdbg.org>


> Le 20 oct. 2025 à 05:40, Johannes Sixt <j6t@kdbg•org> a écrit :
> 
> On Windows, the MSYS layer translates absolute path names generated by
> a shell script from the POSIX style /c/dir/file to the Windows style
> C:/dir/file form that is understood by git.exe. This happens only when
> the absolute path stands on its own as a program argument or a value of
> an environment variable.
> 
> The earlier commits 749d6d166d (config: values of pathname type can be
> prefixed with :(optional), 2025-09-28) and ccfcaf399f (parseopt: values
> of pathname type can be prefixed with :(optional), 2025-09-28) added
> test cases where ":(optional)" is inserted before an absolute path.
> $PWD is used to construct the absolute paths, which gives the POSIX
> form, and the result is ":(optional)/c/dir/template". Such command line
> arguments are no longer recognized as absolute paths and do not undergo
> translation.
> 
> Existing test cases that expect that the specified file does not exist
> are not incorrect (after all, git.exe will not find /c/dir/template).
> Yet, they are conceptually incorrect. That the use of $PWD is erroneous
> is revealed by a test case that expects that the optional file exists.
> Since no such test case is present, add one. Use "$(pwd)" to generate
> the absolute paths, so that the command line arguments become
> ":(optional)C:/dir/template".

Thanks! I probably assumed there was no meaningful difference between the value of PWD and what pwd computes, so (prematurely) optimized for a lookup over executing a command.

Going forward I will probably stick with using pwd, given the difference in platform behavior.

Is there a doc or test lint for that? If not, might be useful.

  reply	other threads:[~2025-10-20 13:44 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-07 20:27 [PATCH 0/1] blame: Skip missing ignore-revs file Noah Pendleton
2021-08-07 20:58 ` Junio C Hamano
2021-08-07 21:34   ` Noah Pendleton
2021-08-08  5:43     ` Junio C Hamano
2021-08-08 17:50       ` Junio C Hamano
2021-08-08 18:21         ` Noah Pendleton
2021-08-09 15:47           ` Junio C Hamano
2024-10-14 20:44             ` [PATCH 0/3] specifying a file that can optionally exist Junio C Hamano
2024-10-14 20:44               ` [PATCH 1/3] t7500: make each piece more independent Junio C Hamano
2024-10-14 20:44               ` [PATCH 2/3] config: values of pathname type can be prefixed with :(optional) Junio C Hamano
2024-10-14 20:44               ` [PATCH 3/3] parseopt: " Junio C Hamano
2025-05-01 21:40             ` [PATCH 0/3] specifying a file that can optionally exist Junio C Hamano
2025-05-01 21:40               ` [PATCH 1/3] t7500: make each piece more independent Junio C Hamano
2025-05-01 21:40               ` [PATCH 2/3] config: values of pathname type can be prefixed with :(optional) Junio C Hamano
2025-05-02  8:52                 ` Patrick Steinhardt
2025-05-02 14:28                   ` Phillip Wood
2025-05-02 20:05                   ` Junio C Hamano
2025-05-01 21:40               ` [PATCH 3/3] parseopt: " Junio C Hamano
2025-09-28 21:29               ` [PATCH v2 0/3] Support :(optional) filepaths D. Ben Knoble
2025-09-28 21:29                 ` [PATCH v2 1/3] t7500: make each piece more independent D. Ben Knoble
2025-09-28 21:29                 ` [PATCH v2 2/3] config: values of pathname type can be prefixed with :(optional) D. Ben Knoble
2025-09-30 15:26                   ` Phillip Wood
2025-10-06 19:00                     ` Junio C Hamano
2025-10-06 19:59                       ` Junio C Hamano
2025-10-06 20:21                         ` Junio C Hamano
2025-10-06 20:22                           ` Junio C Hamano
2025-10-07 12:24                           ` Kristoffer Haugsbakk
2025-10-07 17:04                             ` Junio C Hamano
2025-11-02 16:20                     ` D. Ben Knoble
2025-09-28 21:29                 ` [PATCH v2 3/3] parseopt: " D. Ben Knoble
2025-09-30 15:26                   ` Phillip Wood
2025-11-02 16:20                     ` D. Ben Knoble
2025-11-03  0:10                       ` Eric Sunshine
2025-11-04 18:22                         ` D. Ben Knoble
2025-09-28 22:40                 ` [PATCH v2 0/3] Support :(optional) filepaths Junio C Hamano
2025-09-29 16:42                   ` Ben Knoble
2025-10-20  9:40                 ` [PATCH] t7500: fix tests with absolute path following ":(optional)" on Windows Johannes Sixt
2025-10-20 13:43                   ` Ben Knoble [this message]
2025-10-20 17:32                     ` Johannes Sixt
2025-10-20 18:06                       ` Junio C Hamano
2025-10-20 20:27                       ` D. Ben Knoble
2025-10-20 20:27                         ` D. Ben Knoble
2025-10-20 17:39                     ` Eric Sunshine
2025-10-20 16:17                   ` Junio C Hamano
2025-10-20 17:24                     ` Johannes Sixt
2022-03-04  9:51   ` [PATCH 0/1] blame: Skip missing ignore-revs file Thranur Andul
2021-08-08 17:48 ` [PATCH v2] blame: add config `blame.ignoreRevsFileIsOptional` Noah Pendleton
  -- strict thread matches above, loose matches on Subject: below --
2025-04-25 18:41 Feature request: automatically read .git-blame-ignore-revs or allow global optional config Michael Grosser
2025-04-25 19:54 ` Eric Sunshine
2025-05-01 18:00   ` D. Ben Knoble
2025-05-01 18:28     ` 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=A563E028-19E7-48A0-B538-82ACE821DB67@gmail.com \
    --to=ben.knoble@gmail$(echo .)com \
    --cc=ben.knoble+github@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=grosser.michael@gmail$(echo .)com \
    --cc=j6t@kdbg$(echo .)org \
    --cc=noah.pendleton@gmail$(echo .)com \
    --cc=phillip.wood123@gmail$(echo .)com \
    --cc=ps@pks$(echo .)im \
    --cc=sunshine@sunshineco$(echo .)com \
    --cc=thranur@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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