git-lfs/git/githistory
Taylor Blau 92d8cf18a5 git/githistory: introduce TreePreCallbackFn
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.
2018-07-06 14:42:48 -05:00
..
fixtures git/githistory/fixtures: add annotated tags fixture 2017-12-11 15:27:22 -08:00
fixtures_test.go *: replace git/odb with vendored copy 2018-07-05 11:50:21 -05:00
ref_updater_test.go git/odb: remove extra newline from Tag formatting 2017-12-14 12:30:48 -05:00
ref_updater.go *: replace git/odb with vendored copy 2018-07-05 11:50:21 -05:00
rewriter_test.go git/githistory: introduce TreePreCallbackFn 2018-07-06 14:42:48 -05:00
rewriter.go git/githistory: introduce TreePreCallbackFn 2018-07-06 14:42:48 -05:00