git-annex: create modules/annex

This moves the `annexObjectPath()` helper out of the tests and into a
dedicated sub-package as `annex.ContentLocation()`, and expands it with
`.Pointer()` (which validates using `git annex examinekey`),
`.IsAnnexed()` and `.Content()` to make it a more useful module.

The tests retain their own wrapper version of `ContentLocation()`
because I tried to follow close to the API modules/lfs uses, which in
terms of abstract `git.Blob` and `git.TreeEntry` objects, not in terms
of `repoPath string`s which are more convenient for the tests.
This commit is contained in:
Nick 2022-11-27 00:28:55 -05:00 committed by Matthias Riße
parent b51c2bb4f7
commit aa806493b0
6 changed files with 185 additions and 19 deletions

View file

@ -89,6 +89,7 @@ func (te *TreeEntry) Blob() *Blob {
return &Blob{
ID: ParseGogitHash(te.gogitTreeEntry.Hash),
repo: te.ptree.repo,
gogitEncodedObj: encodedObj,
name: te.Name(),
}