Since we're about to do a v3.0.0 release, let's bump the version to v3.
Make this change automatically with the following command to avoid any
missed items:
git grep -l github.com/git-lfs/git-lfs/v2 | \
xargs sed -i -e 's!github.com/git-lfs/git-lfs/v2!github.com/git-lfs/git-lfs/v3!g'
There are two types of pattern matching with wildmatch patterns in Git:
gitignore and gitattributes patterns. We'd like to support both, but
without the lazy matching that was the cause of so many problems before.
Add a type of pattern to use when creating a new filepathfilter and use
it to instantiate the wildmatch pattern with the proper flags. Remove
the dirs flag, which is unused and has been for sometime, and also the
stripping of trailing slashes, which we want to use to indicate a
directory. Drop the non-strict mode since our pattern matching is now
much improved and compatible with Git.
When our go.mod file was introduced in commit
114e85c2002091eb415040923d872f8e4a4bc636 in PR #3208, the module
path chosen did not include a trailing /v2 component. However,
the Go modules specification now advises that module paths must
have a "major version suffix" which matches the release version.
We therefore add a /v2 suffix to our module path and all its
instances in import paths.
See also https://golang.org/ref/mod#major-version-suffixes for
details regarding the Go module system's major version suffix rule.
We're going to need to scan trees with ls-tree in the git package in the
future, and we can't call into the lfs package because of import loops,
so let's move the scanner to the git package.
While we're at it, let's make two important changes. First, let's
remove the blob size check, since we're going to want this functionality
in order to read all blobs, not just small ones. As part of that, move
that check into the place where we use the output of the scanner so we
don't lose this check.
The other check is to change the name Sha1 to Oid, since we now support
SHA-256 repos as well as SHA-1 repos.
Move the tests and some of the helper functions to the new package as
well.