git-lfs/LICENSE.md

56 lines
2.8 KiB
Markdown
Raw Normal View History

MIT License
2021-06-01 12:53:58 +00:00
Copyright (c) 2014-2021 GitHub, Inc. and Git LFS contributors
2015-03-24 19:12:12 +00:00
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
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 16:15:16 +00:00
Portions of the subprocess and tools directories are copied from Go and are
under the following license:
Copyright (c) 2010 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Note that Git LFS uses components from other Go modules (included in `vendor/`)
which are under different licenses. See those LICENSE files for details.