Documentation
¶
Index ¶
- func ConvertToSSH(httpsURL string) (string, error)
- func GetSSHKeyPath() string
- func IsHTTPSURL(url string) bool
- func IsSSHURL(url string) bool
- func SetSSHKeyPath(cmd *cobra.Command)
- func ValidateSSHKey(keyPath string) error
- type Client
- func (c *Client) Add(ctx context.Context, repoPath string, paths ...string) error
- func (c *Client) Checkout(ctx context.Context, repoPath, ref string) error
- func (c *Client) CheckoutNewBranch(ctx context.Context, repoPath, branch string) error
- func (c *Client) Clone(ctx context.Context, repoURL, destPath string) error
- func (c *Client) Commit(ctx context.Context, repoPath, message string) error
- func (c *Client) Fetch(ctx context.Context, repoPath string) error
- func (c *Client) GetCurrentBranch(ctx context.Context, repoPath string) (string, error)
- func (c *Client) GetCurrentBranchSymbolic(ctx context.Context, repoPath string) (string, error)
- func (c *Client) GetRemoteURL(ctx context.Context, repoPath string) (string, error)
- func (c *Client) HasStagedChanges(ctx context.Context, repoPath string) (bool, error)
- func (c *Client) IsEmpty(ctx context.Context, repoPath string) (bool, error)
- func (c *Client) LsRemote(ctx context.Context, repoURL, ref string) (string, error)
- func (c *Client) Pull(ctx context.Context, repoPath string) error
- func (c *Client) PullRebase(ctx context.Context, repoPath string) error
- func (c *Client) Push(ctx context.Context, repoPath string) error
- func (c *Client) PushSetUpstream(ctx context.Context, repoPath, branch string) error
- func (c *Client) RevParse(ctx context.Context, repoPath, ref string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToSSH ¶
ConvertToSSH converts HTTPS git URLs to SSH format Example: https://github.com/owner/repo.git → git@github.com:owner/repo.git
func SetSSHKeyPath ¶
SetSSHKeyPath sets the global SSH key path from either the flag or environment variable This should be called once at startup from the root command
func ValidateSSHKey ¶
ValidateSSHKey validates SSH key file exists, readable, and has proper permissions If the keyPath looks like actual key content (starts with "-----BEGIN"), it's considered valid
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides high-level git operations with SSH key support
func NewClient ¶
func NewClient() *Client
NewClient creates a new git client using the global SSH key path
func (*Client) CheckoutNewBranch ¶ added in v0.12.7
CheckoutNewBranch creates and switches to a new branch
func (*Client) GetCurrentBranch ¶
GetCurrentBranch returns the current branch name
func (*Client) GetCurrentBranchSymbolic ¶ added in v0.12.7
GetCurrentBranchSymbolic returns the current branch name using symbolic-ref, which works even on empty repos (no commits yet).
func (*Client) GetRemoteURL ¶
GetRemoteURL returns the remote URL for the repository (typically 'origin')
func (*Client) HasStagedChanges ¶ added in v0.5.5
HasStagedChanges checks if there are staged changes ready to be committed
func (*Client) IsEmpty ¶ added in v0.12.7
IsEmpty checks if a repository has no commits (e.g., freshly cloned empty repo)
func (*Client) LsRemote ¶
LsRemote queries a remote repository for a specific ref Returns the commit hash for the ref
func (*Client) PullRebase ¶ added in v0.15.0
PullRebase pulls changes from the remote repository and rebases local commits on top. Used by runInVaultTx to resolve concurrent pushes from multiple sx processes writing to the same management files.
func (*Client) PushSetUpstream ¶ added in v0.12.7
PushSetUpstream pushes and sets the upstream tracking branch (for first push to empty repos)