Documentation
¶
Index ¶
- Constants
- Variables
- func CommitExists(ctx context.Context, repoPath, commitHash string) bool
- func EnsureCleanAfterRestore(ctx context.Context, repoPath, scope, targetCommit string) error
- func ExecuteGitCommand(ctx context.Context, repoPath string, args ...string) ([]byte, error)
- func FindGitRoot(path string) (string, error)
- func GetCommitHash(ctx context.Context, repoPath, ref string) (string, error)
- func GitAuthorForCell(cell string) string
- func IsRemoteRepository(source string) bool
- func PrepareScopedCommit(ctx context.Context, repoPath, scope string) (bool, error)
- func ValidateRepository(repoPath string) error
- type GitConfig
- type NotFastForwardError
- type ThinPackMetadata
Constants ¶
const DefaultGitAuthor = "c2j <c2j@colony2>"
Variables ¶
var ErrNotFastForward = errors.New("not a fast-forward update")
Functions ¶
func CommitExists ¶
CommitExists checks if a commit exists in the repository
func EnsureCleanAfterRestore ¶
func ExecuteGitCommand ¶
ExecuteGitCommand runs a git command with context
func FindGitRoot ¶
FindGitRoot returns the root directory of the git repository
func GetCommitHash ¶
GetCommitHash returns the full commit hash for a given ref
func GitAuthorForCell ¶ added in v0.0.63
GitAuthorForCell supplies the fallback identity when no author is configured. The root cell is a path marker, not a person: Git rejects "." as an author name.
func IsRemoteRepository ¶
IsRemoteRepository reports whether the provided source string looks like a git remote (e.g. ssh/https/file URLs or the SCP-like "git@host:org/repo.git" syntax).
func PrepareScopedCommit ¶
PrepareScopedCommit resets staged changes outside the provided scope, cleans untracked files, and stages the scoped path. It returns true when the scope produces staged changes.
func ValidateRepository ¶
ValidateRepository checks if path is within a valid Git repository
Types ¶
type GitConfig ¶
type GitConfig struct {
Author string `json:"author,omitempty"`
Email string `json:"email,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
}
GitConfig contains common Git configuration
type NotFastForwardError ¶
func (NotFastForwardError) Error ¶
func (e NotFastForwardError) Error() string
func (NotFastForwardError) Is ¶
func (e NotFastForwardError) Is(target error) bool
type ThinPackMetadata ¶
type ThinPackMetadata struct {
CommitHash string `json:"commit_hash"`
ParentHash string `json:"parent_hash"`
RootHash string `json:"root_hash"`
FilePath string `json:"file_path"`
Size int64 `json:"size"`
CreatedAt time.Time `json:"created_at"`
}
ThinPackMetadata describes a thin pack file
func ParseThinPackName ¶
func ParseThinPackName(filename string) (*ThinPackMetadata, error)
ParseThinPackName extracts metadata from thin pack filename