git-lfs/debian
brian m. carlson a66274014c
tools: add a function to properly canonicalize paths
Git consistently uses canonicalized paths internally.  This is for many
reasons, but mostly to verify that a single path is within a repository.
In order to interoperate properly with Git, we need to canonicalize
paths and do it in the same way as Git.

On Unix systems, to canonicalize a path, it is sufficient to make the
path absolute and then resolve any symlinks.  Go provides two functions
to do these two steps, filepath.Abs and filepath.EvalSymlinks, and they
work as advertised.

Windows, however, has much more complex path handling and these
functions do not handle all cases.  The typical way to canonicalize
paths on Windows is using GetFinalPathNameByHandle, and this is the
technique Git uses.

Go, however, does not provide a general API to canonicalize paths,
unlike Rust's std::fs::canonicalize and similar functionality in myriad
other languages.  Therefore, in order to get this working on Windows,
let's add a function to canonicalize paths in the appropriate system
way, one for Unix systems and one for Windows.  The code comes from Go's
standard library, so update the copyright and license accordingly.

Update the CanonicalizePath function to use the new function.  We
duplicate the Abs call because we an absolute path in CanonicalizePath
in some cases even if the path is missing, whereas the new function
needs to do it in all cases because we will use it other situations in
the future.  This should be a simple string check, so it should not
involve an extra system call or other overhead.
2021-03-01 22:10:19 +00:00
..
source Add debian directory and gitignore temporary build files 2015-05-15 15:27:21 +00:00
changelog release: v2.13.0 2020-12-07 21:29:05 +00:00
compat Add debian directory and gitignore temporary build files 2015-05-15 15:27:21 +00:00
control debian: bump version of golang-go 2019-12-19 20:00:56 +00:00
copyright tools: add a function to properly canonicalize paths 2021-03-01 22:10:19 +00:00
git-lfs.lintian-overrides Some cleanup to make debian package pass lintian checks 2015-07-08 02:24:38 +00:00
git-lfs.manpages Fixed #719 missing /usr/share/man/man5/git-lfs-config.5.gz . 2016-04-15 15:59:28 +10:00
postinst Added --system option to install command. This option is invoked from post-install scripts in rpm/deb packages. 2016-06-30 12:05:30 +10:00
prerm debian/prerm: add --system flag 2018-09-20 13:21:34 +02:00
rules debian/rules: update for Go 1.12 2019-07-15 16:40:31 +00:00