gitobjectid

package
v3.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2024 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFileNotFoundInCache = errors.New("git object id does not exist in repository, file might be untracked or modified")

Functions

This section is empty.

Types

type Calc

type Calc struct {
	// contains filtered or unexported fields
}

Calc calculates git object IDs for files. Object IDs are read the first time a digest is requested from the git repository.

func New

func New(gitRepositoryDir string, debugLogf PrintfFn) *Calc

func (*Calc) File

func (h *Calc) File(absPath string) (*digest.Digest, error)

File returns a git object ID as digest for the the file at absPath. If it exist in the cached object ids read from the git repository, it is returned. Otherwise it is calculated.

func (*Calc) FileDigestFromCache

func (h *Calc) FileDigestFromCache(absPath string) (*digest.Digest, error)

FileDigestFromCache looks up the git object id in the cached objects from the git repository. If it is not found ErrFileNotFoundInCache is returned.

On the first call of this function, the git object IDs are loaded from the git repository.

type PrintfFn

type PrintfFn func(format string, a ...any)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL