Documentation
¶
Index ¶
- func CheckRemoteAccessWithHelp(exitOnError bool)
- func CheckRemotePushPermission() error
- func CheckRepoWritePermission() error
- func Commit(message string) error
- func CopyAndAddFile(file, destination string) error
- func DisplaySSHAgentError(exitOnError bool)
- func GetRepository(rootGitRepoPath string) (*git.Repository, error)
- func GetWorktree(rootGitRepoPath string) (*git.Worktree, error)
- func HasOriginRemote() (bool, error)
- func HasRemoteUpdates() (bool, error)
- func InitFromExistingRepo(rootGitRepoPath string) error
- func InitGitRepo(rootGitRepoPath string, remoteUrl string, opts ...bool) (*git.Repository, error)
- func IsGitRepo(path string) bool
- func IsSSHAgentError(err error) bool
- func LinkAndAddFile(file string) error
- func ListFiles() ([]string, error)
- func PullRepo() (bool, error)
- func PushRepo() (bool, error)
- func ReadyForClone(folderPath string) (bool, error)
- func RemoveFile(file string) error
- func SetMaxAncestorSearchDepthForTesting(depth int) func()
- func StageAndCommitAgentSkillChanges(message string) (bool, error)
- func StageAndCommitShellFeatureChanges(message string) (bool, error)
- func StageChange(file string) error
- func UrlIsGitRepo(url string) bool
- type PushCompactionGroup
- type PushCompactionPlan
- type RemoteSyncState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckRemoteAccessWithHelp ¶ added in v0.0.29
func CheckRemoteAccessWithHelp(exitOnError bool)
CheckRemoteAccessWithHelp checks remote push permissions and provides helpful error messages exitOnError: if true, exits on error; if false, displays warning and continues
func CheckRemotePushPermission ¶
func CheckRemotePushPermission() error
CheckRemotePushPermission checks if the user has valid git credentials for pushing to the remote repository. It uses the same authentication mechanism as git push (SSH keys, credential helpers, etc.) to verify access.
func CheckRepoWritePermission ¶
func CheckRepoWritePermission() error
CheckRepoWritePermission checks if the user has write permissions on the dotfiles directory
func CopyAndAddFile ¶
CopyAndAddFile takes a file path as an argument, copies the file to the git repo and adds the file to the git repo.
func DisplaySSHAgentError ¶ added in v0.0.29
func DisplaySSHAgentError(exitOnError bool)
DisplaySSHAgentError displays a helpful error message when SSH agent is not configured exitOnError: if true, exits the program; if false, just displays a warning
func GetRepository ¶ added in v0.0.61
func GetRepository(rootGitRepoPath string) (*git.Repository, error)
GetRepository opens the git repository located at the specified path.
func GetWorktree ¶
GetWorktree returns the worktree of the git repository located at the specified path.
func HasOriginRemote ¶ added in v0.0.60
HasOriginRemote reports whether the configured repository has an origin remote.
func HasRemoteUpdates ¶ added in v0.0.40
HasRemoteUpdates checks if the current branch needs pull from origin. Returns true when remote is ahead or diverged.
func InitFromExistingRepo ¶
InitFromExistingRepo initializes a git repository from an existing repository located at the specified path.
func InitGitRepo ¶
InitGitRepo initializes a new git repository at the specified path, with an optional remote URL and bare repository flag. If a remote URL is provided and the remote repository exists, it clones the repository. Otherwise, it initializes a new empty repository and sets up the remote.
func IsSSHAgentError ¶ added in v0.0.29
IsSSHAgentError checks if the error is related to missing SSH_AUTH_SOCK
func LinkAndAddFile ¶
LinkAndAddFile takes a file path as an argument, makes a hard-link to the git repo and adds the file to the git repo.
func PullRepo ¶ added in v0.0.40
PullRepo pulls changes from the origin remote for the current branch. Returns true if updates were applied, false if already up to date.
func PushRepo ¶
PushRepo pushes changes in the configured git repository to the remote repository. It returns true when commits were pushed and false when the remote was already up to date.
func ReadyForClone ¶
func RemoveFile ¶
func SetMaxAncestorSearchDepthForTesting ¶ added in v0.0.49
func SetMaxAncestorSearchDepthForTesting(depth int) func()
SetMaxAncestorSearchDepthForTesting overrides the remote sync ancestor search depth. It returns a restore function so tests can reset the previous value.
func StageAndCommitAgentSkillChanges ¶ added in v0.0.62
StageAndCommitAgentSkillChanges stages and commits agent skill changes under omd-agents. Returns true when a commit was created, false when there were no committable changes.
func StageAndCommitShellFeatureChanges ¶ added in v0.0.41
StageAndCommitShellFeatureChanges stages and commits shell framework changes under omd-shells. Device-local override manifests (enabled.local.json) are always excluded. Returns true when a commit was created, false when there were no committable changes.
func StageChange ¶
StageChange adds the specified file to the git repository.
func UrlIsGitRepo ¶
Types ¶
type PushCompactionGroup ¶ added in v0.0.56
PushCompactionGroup describes consecutive unpublished commits that can be squashed.
type PushCompactionPlan ¶ added in v0.0.56
type PushCompactionPlan struct {
OriginalCommitCount int
CompactedCommitCount int
Groups []PushCompactionGroup
SkippedReason string
// contains filtered or unexported fields
}
PushCompactionPlan describes eligible unpublished commit compaction work.
func CompactPushHistory ¶ added in v0.0.56
func CompactPushHistory(plan PushCompactionPlan) (PushCompactionPlan, error)
CompactPushHistory rewrites eligible unpublished commits according to the supplied plan.
func PlanPushCompaction ¶ added in v0.0.56
func PlanPushCompaction() (PushCompactionPlan, error)
PlanPushCompaction inspects unpublished local commits for consecutive duplicate subjects.
func (PushCompactionPlan) HasCompaction ¶ added in v0.0.56
func (p PushCompactionPlan) HasCompaction() bool
HasCompaction reports whether the plan would rewrite any commits.
type RemoteSyncState ¶ added in v0.0.40
type RemoteSyncState string
RemoteSyncState describes local/remote relationship for the current branch.
const ( // RemoteSyncUpToDate indicates local and remote point to the same commit. RemoteSyncUpToDate RemoteSyncState = "up-to-date" // RemoteSyncRemoteAhead indicates remote contains commits missing locally. RemoteSyncRemoteAhead RemoteSyncState = "remote-ahead" // RemoteSyncRemoteSignificantlyAhead indicates local is at least 100 commits behind remote. RemoteSyncRemoteSignificantlyAhead RemoteSyncState = "remote-significantly-ahead" // RemoteSyncLocalAhead indicates local contains commits missing on remote. RemoteSyncLocalAhead RemoteSyncState = "local-ahead" // RemoteSyncDiverged indicates both sides contain unique commits. RemoteSyncDiverged RemoteSyncState = "diverged" )
func GetRemoteSyncState ¶ added in v0.0.40
func GetRemoteSyncState() (RemoteSyncState, error)
GetRemoteSyncState returns local/remote relationship for the current branch. It uses a lightweight remote reference list and local commit graph traversal.