92d8cf18a5
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. |
||
---|---|---|
.. | ||
fixtures | ||
fixtures_test.go | ||
ref_updater_test.go | ||
ref_updater.go | ||
rewriter_test.go | ||
rewriter.go |