utils

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 31, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRemoteURLFromRepoDir

func BuildRemoteURLFromRepoDir(repoDir, gitReplicatorRoot string) (string, error)

func DefaultCloneFunc

func DefaultCloneFunc(ctx context.Context, url, dir string) error

func DefaultGetRemoteURL

func DefaultGetRemoteURL(repoDir, gitReplicatorRoot string) (string, error)

Validate that repoDir is under gitReplicatorRoot and build the remote URL

func DefaultSwitchBranchFunc

func DefaultSwitchBranchFunc(ctx context.Context, repoDir, branchName string) error

DefaultSwitchBranchFunc is the default implementation for switching branches, for external use

func FindRepoDir

func FindRepoDir(cwd, gitReplicatorRoot string) (string, error)

FindRepoDir walks up from cwd to gitReplicatorRoot and returns the repo directory (the second-level directory under gitReplicatorRoot, e.g., $HOME/git-replicator/owner/repo).

func GetGitReplicatorRoot

func GetGitReplicatorRoot() (string, error)

GetGitReplicatorRoot returns the path to $HOME/git-replicator

func InitLogger

func InitLogger()

func RemoveDir added in v0.0.2

func RemoveDir(dir string) error

RemoveDir deletes the specified directory and all its contents.

func SwitchBranch

func SwitchBranch(ctx context.Context, repoDir, branchName string) error

SwitchBranch performs the equivalent of 'git switch -C branchname' using go-git

Types

type GitURLParts

type GitURLParts struct {
	Host  string
	Owner string
	Repo  string
}

func ParseGitURL

func ParseGitURL(rawurl string) (GitURLParts, error)

Jump to

Keyboard shortcuts

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