git

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BranchNameFromDir

func BranchNameFromDir(inputDir string) (string, error)

func GetFirstRemote

func GetFirstRemote(inputDir string) (string, error)

GetFirstRemote retrieves the first available remote URL from a git repository.

Parameters:

  • inputDir (string): The directory path to check for git repository

Returns:

  • The first remote URL as a string.
  • An error object (if no git repository found or no remotes configured).

func GetOriginRemote

func GetOriginRemote(inputDir string) (string, error)

GetOriginRemote retrieves the origin remote URL from a git repository.

Parameters:

  • inputDir (string): The directory path to check for git repository

Returns:

  • The origin remote URL as a string.
  • An error object (if no git repository found or no origin remote configured).

func GetRemoteUrl

func GetRemoteUrl(inputDir string) (string, error)

GetRemoteUrl retrieves the appropriate remote URL for LDX-Sync resolution. Priority: origin remote first, then first available remote.

Parameters:

  • inputDir (string): The directory path to check for git repository

Returns:

  • The remote URL as a string.
  • An error object (if no git repository found or no remotes configured).

func NormalizeGitURL

func NormalizeGitURL(rawUrl string) string

NormalizeGitURL converts any git remote URL format (SSH, SCP-style, git://, http://) into a consistent https:// URL with credentials removed. If the URL cannot be parsed, the credential-stripped input is returned as-is.

func RepoFromDir

func RepoFromDir(inputDir string) (*git.Repository, *config.RemoteConfig, error)

func RepoUrlFromDir

func RepoUrlFromDir(inputDir string) (string, error)

func StripGitCredentials

func StripGitCredentials(rawUrl string) string

StripGitCredentials removes userinfo (username, password, token) from a git URL. For SCP-style URLs (user@host:path), the user@ portion is stripped since it may contain tokens used as usernames. For scheme:// URLs, the standard userinfo is removed. If url.Parse fails (e.g., malformed port), a pattern-based fallback strips credentials from the raw string to prevent leakage.

Types

This section is empty.

Jump to

Keyboard shortcuts

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