utils

package
v0.1.46 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectGitRepoRoot added in v0.1.41

func DetectGitRepoRoot() string

DetectGitRepoRoot returns the absolute path to the root of the current git repository. Returns an empty string if not in a git repository.

func GenerateFNVHash

func GenerateFNVHash(data []byte) uint64

GenerateFNVHash generates a 64-bit FNV-1a hash from the input bytes

Types

type GitRemoteInfo added in v0.1.30

type GitRemoteInfo struct {
	Host        string // e.g., "gitlab.com" or "gitlab.example.com"
	ProjectPath string // e.g., "group/project" or "group/subgroup/project"
	URL         string // The full GitLab URL, e.g., "https://gitlab.com"
	RepoRoot    string // Absolute path to the git repository root
}

GitRemoteInfo contains parsed information from a git remote URL

func DetectGitRemote added in v0.1.30

func DetectGitRemote() *GitRemoteInfo

DetectGitRemote attempts to detect GitLab URL and project path from git remote. It tries the "origin" remote first. Returns nil if detection fails (not a git repo, no remote, not a GitLab URL, etc.)

func ParseGitRemoteURL added in v0.1.30

func ParseGitRemoteURL(remoteURL string) *GitRemoteInfo

ParseGitRemoteURL parses a git remote URL and extracts host and project path. Supports the following formats:

  • SSH URL: ssh://git@host[:port]/group/project.git
  • SSH SCP-like: git@host:group/project.git
  • HTTPS: https://host[:port]/group/project.git
  • Git protocol: git://host[:port]/group/project.git

Returns nil if the URL cannot be parsed.

Jump to

Keyboard shortcuts

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