Documentation
¶
Index ¶
- Constants
- func IsInstalled() bool
- type Client
- func (c *Client) Add(files ...string) error
- func (c *Client) Clean(files ...string) error
- func (c *Client) Commit(msg string) error
- func (c *Client) HasRemote() bool
- func (c *Client) Init() error
- func (c *Client) IsRepo() bool
- func (c *Client) Lock() (func(), error)
- func (c *Client) Restore(files ...string) error
- func (c *Client) Rm(files ...string) error
- func (c *Client) Run(args ...string) (string, error)
- func (c *Client) Status() (string, error)
- func (c *Client) Sync() error
Constants ¶
const DefaultLockTimeout = 30 * time.Second
DefaultLockTimeout is the maximum time to wait for a lock before giving up.
Variables ¶
This section is empty.
Functions ¶
func IsInstalled ¶ added in v0.3.0
func IsInstalled() bool
IsInstalled checks if git is available in the system PATH.
Types ¶
type Client ¶
Client wraps git command execution with a global file-based lock for process safety.
func (*Client) HasRemote ¶
HasRemote checks if there is a 'origin' remote configured. For now, we hardcode 'origin' as the default remote to check.
func (*Client) IsRepo ¶ added in v0.3.0
IsRepo checks if the current working directory is a valid git repository.
func (*Client) Restore ¶ added in v0.2.0
Restore restores working tree files (discards changes in working directory). Use with caution.
func (*Client) Run ¶
Run executes a raw git command in the working directory. NOTE: It does NOT acquire the lock automatically. The caller must manage transaction safety via Client.Lock().