scalar: make enlistment delete to work on all POSIX platforms

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Marcel Telka committed May 17, 2024 at 16:42 UTC 72b8c934f236711921014c26c9dc64c1611cff82
1 file changed -4
scalar.c
-4
@@ -361,16 +361,13 @@ static char *remote_default_branch(const char *url)
361
362 static int delete_enlistment(struct strbuf *enlistment)
363 {
364 -#ifdef WIN32
364 struct strbuf parent = STRBUF_INIT;
365 size_t offset;
366 char *path_sep;
368 -#endif
367
368 if (unregister_dir())
369 return error(_("failed to unregister repository"));
370
373 -#ifdef WIN32
371 /*
372 * Change the current directory to one outside of the enlistment so
373 * that we may delete everything underneath it.
@@ -385,7 +382,6 @@ static int delete_enlistment(struct strbuf *enlistment)
382 return res;
383 }
384 strbuf_release(&parent);
388 -#endif
385
386 if (have_fsmonitor_support() && stop_fsmonitor_daemon())
387 return error(_("failed to stop the FSMonitor daemon"));