From: Junio C Hamano <gitster@pobox.com>
To: Elijah Newren <newren@gmail.com>
Cc: git@vger.kernel.org, Thomas Gummerer <t.gummerer@gmail.com>,
joostkremers@fastmail.fm, Kyle Meyer <kyle@kyleam.com>
Subject: Re: [PATCH] stash: disable literal treatment when passing top pathspec
Date: Mon, 11 Apr 2022 10:55:23 -0700 [thread overview]
Message-ID: <xmqq8rsbjyic.fsf@gitster.g> (raw)
In-Reply-To: <877d7y3nif.fsf@kyleam.com> (Kyle Meyer's message of "Sat, 09 Apr 2022 00:10:32 -0400")
Kyle Meyer <kyle@kyleam.com> writes:
> 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).
Interesting. I find the logic there a bit convoluted. IIUC, it
goes like this:
- we do not want to lose the directory our process was originally
in, which is recorded in startup_info->original_cmd.
- we have gone up to the root of the working tree, and running
"clean" from there is what we want---even if we started "git
stash" from a subdirectory, we want to make the entire working
tree clean, not just inside our subdirectory.
- but we came up with a hack that allows us to skip removing the
directory the Git process started at. To take advantage of the
mechanism, we'd need to start from that original_cmd.
- but then "clean" run from that subdirectory normally cleans only
that subdirectory, which is not what we want to do. To work it
around, we'd need to pass :/ pathspec to say that we are cleaning
from the top.
It makes me suspect that "we protect current directory" is a too
specialized way that didn't really consider the possibility that we
sometimes spawn a subcommand. Even "we protect this directory" may
not be sufficient and we may need a "we protect these directories",
I suspect. When the user originally starts "git foo" in one
directory, which may have to run "git bar" in another directory, and
"git bar" would want to protect the directory it starts in and also
where "git foo" started from, no? It almost makes me suspect that
we'd want some "git" wide option that allows us to pass a list of
paths not to rmdir, whose default value is ["."], or something.
Elijah, thoughts?
But as a short-term fix, I think "--no-literal-pathspecs" is fine for
this code path.
Thanks.
prev parent reply other threads:[~2022-04-11 17:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-08 3:12 [PATCH] stash: disable literal treatment when passing top pathspec Kyle Meyer
2022-04-08 6:33 ` Bagas Sanjaya
2022-04-08 8:46 ` Ævar Arnfjörð Bjarmason
2022-04-08 18:47 ` Junio C Hamano
2022-04-08 18:46 ` Junio C Hamano
2022-04-09 4:10 ` Kyle Meyer
2022-04-11 17:55 ` Junio C Hamano [this message]
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=xmqq8rsbjyic.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=joostkremers@fastmail.fm \
--cc=kyle@kyleam.com \
--cc=newren@gmail.com \
--cc=t.gummerer@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).