Documentation
¶
Index ¶
- Constants
- func Checkout(userArgs []string)
- func Diff()
- func ExtractUniqueRemotes(dirs []string) (map[string]string, []string)
- func GetBranchRemoteURL(dir string, branch string) (string, error)
- func GetCurrentBranch(dir string) (string, error)
- func GitSSHCommand(socketPath string) string
- func Interactive()
- func ParseSSHDestination(remoteURL string) (string, bool)
- func Pull(userArgs []string, mux bool, muxN int)
- func Push(userArgs []string, mux bool, muxN int)
- func Status()
- type MuxSockets
- type MuxState
Constants ¶
const ( MODIFIED changeKind = iota ADDED DELETED RENAMED COPIED TYPE UNMERGED CHANGE_KIND_COUNT )
Variables ¶
This section is empty.
Functions ¶
func ExtractUniqueRemotes ¶
ExtractUniqueRemotes takes a list of directories and returns: - a map of dir -> SSH destination (only for dirs with SSH remotes) - a deduplicated slice of unique SSH destinations
func GetBranchRemoteURL ¶
GetBranchRemoteURL returns the remote URL for the given branch in the repo at dir. It first looks up the remote name configured for the branch, falling back to "origin". Then it resolves that remote name to a URL.
func GetCurrentBranch ¶
GetCurrentBranch returns the current branch name for the repo at dir.
func GitSSHCommand ¶
GitSSHCommand returns the GIT_SSH_COMMAND value that will use the given socket.
func Interactive ¶
func Interactive()
func ParseSSHDestination ¶
ParseSSHDestination extracts the SSH destination (e.g. "git@github.com") from a remote URL matching the pattern <user>@<host>:<repo>. Returns the destination and true if it matches, or empty string and false otherwise.
Types ¶
type MuxSockets ¶
type MuxSockets struct {
// contains filtered or unexported fields
}
MuxSockets holds the mapping of SSH destination -> socket path and manages cleanup of the ControlMaster connections.
func EstablishMasters ¶
func EstablishMasters(destinations []string) (*MuxSockets, error)
EstablishMasters creates a ControlMaster connection for each SSH destination. Stdin/stdout/stderr are connected to the terminal so PIN prompts work. Returns an error immediately if any master fails to establish.
func (*MuxSockets) Close ¶
func (m *MuxSockets) Close()
Close tears down all ControlMaster connections and removes the socket directory.
type MuxState ¶
type MuxState struct {
Sockets *MuxSockets
DirToSSH map[string]string
Sem chan struct{}
}
MuxState holds everything needed to apply multiplexing to git commands.
func InitMux ¶
InitMux sets up SSH multiplexing for the given directories. The caller must defer MuxState.Sockets.Close().
func (*MuxState) Acquire ¶
func (m *MuxState) Acquire() func()
Acquire takes a semaphore slot, blocking if at capacity. Returns a release function to be deferred.
func (*MuxState) ApplyToCmd ¶
ApplyToCmd sets GIT_SSH_COMMAND on the exec.Cmd if the dir has a multiplexed SSH remote.