gitutil

package
v0.67.3 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractBaseRepo added in v0.51.7

func ExtractBaseRepo(repoPath string) string

ExtractBaseRepo extracts the base repository (owner/repo) from a repository path that may include subfolders. For "actions/checkout" -> "actions/checkout" For "github/codeql-action/upload-sarif" -> "github/codeql-action"

func FindGitRoot added in v0.51.7

func FindGitRoot() (string, error)

FindGitRoot finds the root directory of the git repository. Returns an error if not in a git repository or if the git command fails.

func IsAuthError

func IsAuthError(errMsg string) bool

IsAuthError checks if an error message indicates an authentication issue. This is used to detect when GitHub API calls fail due to missing or invalid credentials.

func IsHexString

func IsHexString(s string) bool

IsHexString checks if a string contains only hexadecimal characters. This is used to validate Git commit SHAs and other hexadecimal identifiers.

func IsRateLimitError added in v0.64.1

func IsRateLimitError(errMsg string) bool

IsRateLimitError checks if an error message indicates a GitHub API rate limit error. This is used to detect transient failures caused by hitting the GitHub API rate limit (HTTP 403 "API rate limit exceeded" or HTTP 429 responses).

func ReadFileFromHEAD added in v0.67.3

func ReadFileFromHEAD(filePath string) (string, error)

ReadFileFromHEAD returns the content of filePath as recorded in the most recent git commit (HEAD). This is used in safe update mode so that the manifest baseline comes from the committed version of the lock file, not from the working-tree copy, preventing a local agent from tampering with the file to bypass enforcement.

filePath may be absolute or relative; it is resolved to an absolute path before computing its path relative to the git root.

Returns an error when:

  • the current directory is not inside a git repository
  • the file does not exist in HEAD (e.g. it has never been committed)
  • the git command fails for another reason

Types

This section is empty.

Jump to

Keyboard shortcuts

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