Re: [PATCH] scalar: make enlistment delete to work on all POSIX platforms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2024.05.17 16:42, Marcel Telka wrote:
> 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@xxxxxxxx>
> ---
>  scalar.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> 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
>  
>  	if (have_fsmonitor_support() && stop_fsmonitor_daemon())
>  		return error(_("failed to stop the FSMonitor daemon"));
> 

This looks like a straightforward change; none of the formerly protected
logic uses anything specific to Windows, and tests still pass on Linux,
so this looks good to me.

Reviewed-by: Josh Steadmon <steadmon@xxxxxxxxxx>




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux