From: Johannes Schindelin <Johannes.Schindelin@gmx•de>
To: Junio C Hamano <gitster@pobox•com>
Cc: Marcel Telka <marcel@telka•sk>,
git@vger•kernel.org, Victoria Dye <vdye@github•com>,
Matthew John Cheetham <mjcheetham@outlook•com>
Subject: Re: [PATCH] scalar: make enlistment delete to work on all POSIX platforms
Date: Sat, 18 May 2024 21:45:23 +0200 (CEST) [thread overview]
Message-ID: <fb20ebe4-e643-211e-29c8-2cbfb4b49abf@gmx.de> (raw)
In-Reply-To: <xmqqbk54go51.fsf@gitster.g>
Hi,
On Fri, 17 May 2024, Junio C Hamano wrote:
> Marcel Telka <marcel@telka•sk> writes:
>
> > The ability to remove the current working directory is not guaranteed by
> > POSIX so it is better to go out of the directory we want to delete on
> > all platforms unconditionally.
> >
> > Signed-off-by: Marcel Telka <marcel@telka•sk>
> > ---
> > scalar.c | 4 ----
> > 1 file changed, 4 deletions(-)
>
> Let's CC a few folks that had their hands in the delete_enlistment()
> function over the years for their opinions on this change.
>
> > diff --git a/scalar.c b/scalar.c
> > index 7234049a1b..331b91dbdb 100644
> > --- a/scalar.c
> > +++ b/scalar.c
> > @@ -361,16 +361,13 @@ static char *remote_default_branch(const char *url)
> >
> > static int delete_enlistment(struct strbuf *enlistment)
> > {
> > -#ifdef WIN32
> > struct strbuf parent = STRBUF_INIT;
> > size_t offset;
> > char *path_sep;
> > -#endif
> >
> > if (unregister_dir())
> > return error(_("failed to unregister repository"));
> >
> > -#ifdef WIN32
> > /*
> > * Change the current directory to one outside of the enlistment so
> > * that we may delete everything underneath it.
> > @@ -385,7 +382,6 @@ static int delete_enlistment(struct strbuf *enlistment)
> > return res;
> > }
> > strbuf_release(&parent);
> > -#endif
Basically, this turns the previously Windows-only logic to `chdir("..")`
into the now-universal logic.
I like it!
Thank you,
Johannes
> >
> > if (have_fsmonitor_support() && stop_fsmonitor_daemon())
> > return error(_("failed to stop the FSMonitor daemon"));
>
next prev parent reply other threads:[~2024-05-18 19:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-17 14:42 [PATCH] scalar: make enlistment delete to work on all POSIX platforms Marcel Telka
2024-05-17 20:49 ` Junio C Hamano
2024-05-18 19:45 ` Johannes Schindelin [this message]
2024-05-30 20:57 ` Josh Steadmon
2024-05-30 21:17 ` Junio C Hamano
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=fb20ebe4-e643-211e-29c8-2cbfb4b49abf@gmx.de \
--to=johannes.schindelin@gmx$(echo .)de \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
--cc=marcel@telka$(echo .)sk \
--cc=mjcheetham@outlook$(echo .)com \
--cc=vdye@github$(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