Re: [PATCH 24/25] worktree move: accept destination as directory
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- May 12, 2016, 05:58 UTC
- Message-ID
- <57341B9B.9010600@kdbg.org>
- In-Reply-To
- <xmqqbn4cjn2g.fsf@gitster.mtv.corp.google.com>
Am 11.05.2016 um 23:34 schrieb Junio C Hamano:
Show 21 quoted lines
> Johannes Sixt <j6t@kdbg.org> 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