Documentation
¶
Overview ¶
Package git runs the host's git binary for apps deployed from their repository. It knows nothing about CasaOS apps: a folder, a URL, a branch and a way in.
Index ¶
- Constants
- Variables
- func AddWorktree(ctx context.Context, dir, commit, path string, auth Auth) error
- func Clone(ctx context.Context, url, branch, dir string, auth Auth) error
- func DefaultBranch(ctx context.Context, url string, auth Auth) (string, error)
- func FastForward(ctx context.Context, dir, commit string) error
- func Fetch(ctx context.Context, dir, url, branch string, auth Auth) (string, error)
- func HasCommit(ctx context.Context, dir, commit string) bool
- func IsAncestor(ctx context.Context, dir, ancestor, descendant string) (bool, error)
- func IsTracked(ctx context.Context, dir, path string) (bool, error)
- func LsRemote(ctx context.Context, url, branch string, auth Auth) (string, error)
- func Prune(ctx context.Context, dir string) error
- func RemoveWorktree(ctx context.Context, dir, path string) error
- func ResetKeep(ctx context.Context, dir, commit string) error
- func Subject(ctx context.Context, dir, commit string) (string, error)
- type Auth
- type Error
- type Info
Constants ¶
const ( AccessNone = "none" AccessKey = "key" AccessToken = "token" )
How a remote is reached.
Variables ¶
var ErrNoSSHClient = errors.New("the ssh client is not installed on this machine")
ErrNoSSHClient is the answer for a deploy key on a machine that cannot use one.
Functions ¶
func AddWorktree ¶
AddWorktree checks commit out, detached, at path, submodules included.
func DefaultBranch ¶
DefaultBranch is the branch the remote's HEAD points to.
func FastForward ¶
FastForward moves the checked-out branch forward to commit, and refuses anything else.
func IsAncestor ¶
IsAncestor reports whether ancestor is descendant or one of its ancestors.
func RemoveWorktree ¶
RemoveWorktree removes a worktree AddWorktree made, and what git knows of it.
Types ¶
type Auth ¶
type Auth struct {
Mode string
KeyPath string
KnownHostsPath string
Token string
// AskpassDir is where a token's askpass helper is written, in a folder of its own that
// goes after each command. Not /tmp, which may be mounted noexec.
AskpassDir string
}
Auth is how a remote is reached. It becomes environment, never arguments.