Documentation ¶
Overview ¶
Package gitsync provides file tree mirroring via git. It is capable of cloning a remote repository and updating the local copy to match the head of a particular branch.
This package assumes that the local copy is non-authoritative and that any local changes found may be discarded. It performs the equivalent of a "git reset hard" whenever the local copy is synchronized.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*Worker)
Option is a gitsync option.
func Auth ¶
func Auth(auth transport.AuthMethod) Option
Auth returns an option that sets the given authentication method.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker is responsible for keeping local files in sync with a remote. It should be created by calling gitsync.New.
func New ¶
New returns a Worker for the repository at the given path.
The path should specify a file system directory to which the contents of the remote branch will be mirrored.
The given origin will be used to access the remote.
New is nondestructive. Calls to CloneOrPull will perform file system initialization and cloning as needed.
func (*Worker) CloneOrPull ¶
CloneOrPull attempts to update the local file system to match a particular branch on the origin. It performs the equivalent of git clone, pull and checkout as necessary to accomplish this.
CloneOrPull is destructive. Files within the local copy may be discarded in order for it to accomplish its goal. In the case of failure it may attempt to destroy the local copy and re-clone.