From: "brian m. carlson" <email@example.com> To: Jonathan Nieder <firstname.lastname@example.org> Cc: email@example.com, Johannes Schindelin <Johannes.Schindelin@gmx.de> Subject: Re: [PATCH] rev-parse: add option for absolute or relative path formatting Date: Thu, 5 Nov 2020 03:11:53 +0000 [thread overview] Message-ID: <20201105031153.GA1332931@camp.crustytoothpaste.net> (raw) In-Reply-To: <20201104221659.GA3183353@google.com> [-- Attachment #1: Type: text/plain, Size: 2442 bytes --] On 2020-11-04 at 22:16:59, Jonathan Nieder wrote: > brian m. carlson wrote: > > > This impetus for this patch is Git LFS, which is written in Go. Go > > lacks a cross-platform way to canonicalize paths in the same way that > > Git does, so when Git produces relative paths, such as in some cases > > with --git-common-dir, we end up with problems when users are doing > > things with unusual paths on Windows, such as when using SUBST or > > OneDrive or various other edge cases. Go upstream does not appear eager > > to address this problem. > > Can you describe the user-facing symptom? While reviewing > https://firstname.lastname@example.org/ > I'm trying to understand the motivation and I'm getting stuck at > trying to understand the basics of the problem being solved. > > E.g. is this about being able to compare paths, being able to open > files, resolving symlinks, something else? The goal is to resolve paths the way Git does and allow verify that a path is within the repository. Some paths, such as SUBST drives, are canonicalized by Git using GetFinalPathNameByHandle, which is the standard way of canonicalizing paths on Windows. Go provides filepath.EvalSymlinks, which does not handle these paths, and consequently, a check that a given path is within the repository (or git directory) fails because Go sees the path as being on one drive (after canonicalization) and Git sees the repository as being on another. This is in part because the .git directory we've canonicalized in Go is totally different from the path that Git has for it, and consequently they aren't comparable. That's the user-facing symptom. There are a variety of other Windows paths that are handled differently as well beyond the SUBST paths. I'm not an expert on Windows or Windows paths, so I can't enumerate all the cases where one case works and the other fails. Ideally Go would learn to canonicalize paths the way the system does using a cross-platform function. I believe there's an issue upstream to deal with this at https://github.com/golang/go/issues/42201. This is also generally applicable for scripting, where realpath(1) is not always available (e.g., on macOS), but mostly this is here to make Windows work more nicely, since it has more complex path functionality. -- brian m. carlson (he/him or they/them) Houston, Texas, US [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 263 bytes --]
next prev parent reply other threads:[~2020-11-05 3:12 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-08 18:50 brian m. carlson 2020-09-09 3:23 ` Johannes Schindelin 2020-09-09 22:31 ` brian m. carlson 2020-09-09 14:51 ` SZEDER Gábor 2020-09-09 22:23 ` brian m. carlson 2020-09-10 15:19 ` SZEDER Gábor 2020-09-11 0:03 ` brian m. carlson 2020-11-04 22:16 ` Jonathan Nieder 2020-11-05 3:11 ` brian m. carlson [this message] 2020-11-06 0:51 ` Jonathan Nieder 2020-11-06 1:57 ` brian m. carlson
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 List information: http://vger.kernel.org/majordomo-info.html * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201105031153.GA1332931@camp.crustytoothpaste.net \ --email@example.com \ --cc=Johannes.Schindelin@gmx.de \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: [PATCH] rev-parse: add option for absolute or relative path formatting' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this inbox: https://80x24.org/mirrors/git.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).