Documentation
¶
Index ¶
- func BranchNameFromDir(inputDir string) (string, error)
- func GetFirstRemote(inputDir string) (string, error)
- func GetOriginRemote(inputDir string) (string, error)
- func GetRemoteUrl(inputDir string) (string, error)
- func NormalizeGitURL(rawUrl string) string
- func RepoFromDir(inputDir string) (*git.Repository, *config.RemoteConfig, error)
- func RepoUrlFromDir(inputDir string) (string, error)
- func StripGitCredentials(rawUrl string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BranchNameFromDir ¶
func GetFirstRemote ¶
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 ¶
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 ¶
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 ¶
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 StripGitCredentials ¶
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.