Subject: Re: [PATCH 24/25] worktree move: accept destination as directory

From: Johannes Sixt <[email-masked]>
Date: Thu, 12 May 2016 07:58:51 +0200

Am 11.05.2016 um 23:34 schrieb Junio C Hamano:
> Johannes Sixt <[email-masked]> writes:
>
>>> As this path is read from a file git itself creates, and if we know
>>> that it will always contain forward slashes, then I agree that it
>>> could be potentially confusing to later readers to see
>>> git_find_last_dir_sep(). So, keeping it as-is seems correct.
>>
>> Please allow me to disagree. There should not be any assumption that a
>> path uses forward slashes as directory separator, except when the path
>> is
>>
>> - a pathspec
>> - a ref
>> - a path found in the object database including the index
>
> I think standardising on one way for what we write out would give
> less hassle to users.  The human end users should not be opening
> these files in their editors and futzing with their contents, but
> there are third-party tools and reimplementations of Git.  Forcing
> them to be prepared for input with slashes and backslashes does not
> make much sense to me.

It is the opposite: We would force other tools to write slashes even 
though on Windows both types of slashes are allowed as directory separators.

> Is there an upside for us to accept both slashes in this file?

Obviously, yes: We can accept what third-party tools write.

BTW, we also have to accept absolute paths in the file, no? Then we 
cannot assume that the path begins with a slash on Windows; absolute 
paths would come in drive letter style on Windows.

-- Hannes