git

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package git provides utilities to extract Git metadata for files and lines.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RepoRoot

func RepoRoot() (string, error)

RepoRoot returns the root directory of the current Git repository.

Types

type BlameInfo

type BlameInfo struct {
	CommitHash string // Commit SHA
	Author     string // Author name
	Email      string // Author email
	Timestamp  time.Time
	Summary    string // Commit message summary
	Line       int    // Line number (1-based)
}

BlameInfo holds blame metadata for a specific line in a file.

func BlameLine

func BlameLine(file string, line int) (*BlameInfo, error)

BlameLine returns blame metadata for a specific file and line.

type CommitMeta

type CommitMeta struct {
	Hash      string    // Commit SHA
	Author    string    // Author name
	Email     string    // Author email
	Timestamp time.Time // Commit date
	Message   string    // Commit message
}

CommitMeta represents metadata about a Git commit.

func LatestCommit

func LatestCommit() (*CommitMeta, error)

LatestCommit returns metadata for the latest commit in the repository.

type GitMetadata added in v0.2.1

type GitMetadata struct {
	RepoRoot    string    // Repository root path
	Branch      string    // Current branch name
	CommitHash  string    // Full commit hash
	CommitShort string    // Short commit hash (first 8 chars)
	Author      string    // Author name
	Email       string    // Author email
	Message     string    // Commit message
	Timestamp   time.Time // Commit timestamp
	IsDirty     bool      // Whether working directory has uncommitted changes
}

GitMetadata represents complete Git repository information.

func GetGitMetadata added in v0.2.1

func GetGitMetadata() (*GitMetadata, error)

GetGitMetadata returns complete Git repository metadata.

Jump to

Keyboard shortcuts

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