git

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2025 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneInto

func CloneInto(repo, ref, cacheDir string, submodules bool) (string, error)

CloneInto clones/fetches repo@ref into cacheDir/repo and checks out the ref in the workdir. Returns the workdir path with the working tree set to the requested ref (detached HEAD).

func GetCurrentCommitHash added in v0.7.0

func GetCurrentCommitHash(workdir string) (string, error)

GetCurrentCommitHash returns the commit hash of the currently checked out ref in the given directory. Returns the full 40-character SHA-1 hash.

func GetRemoteCommitHash added in v0.7.0

func GetRemoteCommitHash(repo, ref string) (string, error)

GetRemoteCommitHash fetches the remote ref and returns its commit hash without checking it out. This function is used to check if the remote has changed since the last cache. If network fails, returns an error that can be handled gracefully by the caller.

func IsCommitHash added in v0.7.0

func IsCommitHash(ref string) bool

IsCommitHash checks if the given ref is already a commit hash (40-character hex string). This is used to validate configuration - if ref is already a commit hash, commit hash tracking doesn't make sense since commit hashes don't change.

Types

This section is empty.

Jump to

Keyboard shortcuts

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