git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] stash: disable literal treatment when passing top pathspec

From
Kyle Meyer <kyle@kyleam.com>
Date
Apr 9, 2022, 04:10 UTC
Message-ID
<877d7y3nif.fsf@kyleam.com>
In-Reply-To
<xmqqa6cvmmzn.fsf@gitster.g>
Junio C Hamano writes:
> Kyle Meyer <kyle@kyleam.com> writes:
[...]
Show 17 quoted lines
>>  * the 'git clean' call, triggered by --include-untracked, does not
>>    remove untracked files from the working tree
>>
>>  * the 'git checkout' call, triggered by --keep-index, fails with a
>>    message about ":/" not matching any known files, and the main
>>    command exits with a non-zero status
>>
>> Fix both of these spots by passing --no-literal-pathspecs to the
>> subprocess commands.
>
> Yuck (to the original problem, not to the proposed solution).
>
> I wonder if stopping to use ":/" (or using "." instead, if we need
> to give _some_ pathspec) is a better approach.  Don't we move to the
> top of the working tree by the time cmd_stash() is called and whatever
> subprocess we spawn via run_command() interface will start at the
> top anyway, no?

For the --keep-index/checkout case, yes, it looks like the command starts from the top-level. Passing "." as the pathspec to checkout works fine, as far as I can tell.

However, for --include-untracked/clean case, the subprocess directory is set to startup_info->original_cwd since 0fce211ccc (stash: do not attempt to remove startup_info->original_cwd, 2021-12-09).

Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 7 in “stash: disable literal treatment when passing top pathspec”
  1. stash: disable literal treatment when passing top pathspecKyle Meyer, Apr 8, 2022
  2. Bagas SanjayaApr 8, 2022
  3. Ævar Arnfjörð BjarmasonApr 8, 2022
  4. Junio C HamanoApr 8, 2022
  5. Junio C HamanoApr 8, 2022
  6. Kyle MeyerApr 9, 2022
  7. Junio C HamanoApr 11, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.