The io/ioutil package has been deprecated as of Go 1.16 [1]. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.
[1]: https://golang.org/doc/go1.16#ioutil
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This caused a substantial performance regression. We should solve this
in a different way.
This reverts commit 3acbec20a6a3b211f4ef3e5ec83cecf0c1fc63b0.
This caused a substantial performance regression. We should solve this
in a different way.
This reverts commit 791690a11e189b71bfbc4888f50b4b69cc1370c2.
TestRewriterDoesntVisitUnchangedSubtrees:
* Changed to TestRewriterDoesVisitUnchangedSubtrees (BlobFn will now be
called on every blobs whether they changed or not)
* Assert changed to match that.
TestRewriterIgnoresPathsThatDontMatchFilter:
* Update "seen" count: "subdir/b.txt" should now be seen twice.
TestHistoryRewriterCallbacksSubtrees:
* Update asserted call order. BlobFn("a.txt") is now called twice.
Caching is now done inside the BlobFn function instead of in the caller.
To do this, the OID of the original blob is given as an argument to
BlobFn.
Adapt migrate() calls to this :
* For "migrate info", a set of "seen" OID is cached to avoid counting
them twice.
* For "migrate import", the cleaned blob is cached and reused.
Fixesgit-lfs/git-lfs#4628
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.
Git will start to support SHA-256 as a hash for repositories in the near
future. Let's update gitobj to version 2 to support SHA-256
repositories properly. We initialize the repository based on the
extensions.objectFormat value, if one is provided, since this is the
configuration key that represents the hash algorithm.
Vendor the proper dependencies in place.
To determine the paths to migrate from a repository's .gitattributes, a
caller must do the following two things in order:
1. Read the .gitattributes file(s) in a given tree contained within
the repository.
2. Rewrite blobs according to the attributes applied to their paths
via the .gitattributes file(s) read in (1).
The framework for accomplishing the task necessary in (1) was written in
the previous commit. This commit introduces the rest of that mechanism
for (1).
Because a Git object's SHA-1 signature depends on its children, we must
visit the object graph in a topological ordering. This is not sufficient
for our purposes, since the patterns in a .gitattributes file cascade
downwards.
In other words, while we have to migrate from the leaves of the tree to
its root, we have to read the .gitattributes file(s) from root to
leaves.
To accomplish this, we introduce a new callback function in the
*githistory.RewriteOptions structure, TreePreCallbackFn, which is called
once as soon as a tree is opened for the first time, and before any
blobs or sub-trees are rewritten.
This provides the optimal time to inspect the repository's contents for
interesting .gitattributes files before migrating the blobs within.
We will use this new callback function in the following commit in order
to do precisely the task as described above.