Documentation
¶
Index ¶
- type Client
- func (c *Client) Add(dir string, paths ...string) error
- func (c *Client) Commit(dir string, message string, paths ...string) error
- func (c *Client) GetMainWorktreeRoot() (string, error)
- func (c *Client) GetRepoRoot() (string, error)
- func (c *Client) GetUserName() string
- func (c *Client) IsRepo() bool
- func (c *Client) IsRepoAt(dir string) bool
- func (c *Client) IsWorktree() bool
- func (c *Client) StatusPorcelain(dir string, paths ...string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct{}
Client provides git operations.
func (*Client) Add ¶ added in v0.20.0
Add stages the given paths. dir sets the working directory for the command.
func (*Client) Commit ¶ added in v0.20.0
Commit creates a commit with the given message. When paths are provided, only those paths are included in the commit - other staged changes are left untouched. This is equivalent to running `git commit -m <msg> -- <paths>`, which scopes the commit to the specified paths without the --only flag. dir sets the working directory for the command.
func (*Client) GetMainWorktreeRoot ¶ added in v0.20.0
GetMainWorktreeRoot returns the root directory of the main worktree. Returns an error if not in a git repo or not in a worktree.
func (*Client) GetRepoRoot ¶
GetRepoRoot returns the repository root directory. Returns an error if not in a git repository.
func (*Client) GetUserName ¶
GetUserName returns the configured git user.name. Returns empty string if git is unavailable or user.name is not configured.
func (*Client) IsRepoAt ¶ added in v0.20.0
IsRepoAt returns true if the given directory is inside a git repository.
func (*Client) IsWorktree ¶ added in v0.20.0
IsWorktree returns true if the current directory is inside a git worktree (not the main worktree). Returns false if not in a git repo.