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

@ -15,6 +15,10 @@ import (
// This file contains common functions between the gogit and !gogit variants for git Blobs
func (b *Blob) Repo() *Repository {
return b.repo
}
// Name returns name of the tree entry this blob object was created from (or empty string)
func (b *Blob) Name() string {
return b.name