Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clone ¶
func Clone(opts CloneOptions) error
Clone downloads a remote repository and materialises it on disk.
Steps:
- Resolve destination directory and create it.
- Initialise a fresh kitcat repo inside it.
- Discover remote refs via the smart HTTP protocol.
- Request all objects for the desired branch via git-upload-pack.
- Unpack the received packfile into the local object store.
- Write remote-tracking refs and the local branch pointer.
- Check out the working tree.
- Record the remote URL in .kitcat/config.
func Push ¶
func Push(opts PushOptions) error
Push sends local commits for a branch to a remote repository.
Steps:
- Resolve the remote URL from options or config.
- Resolve the local branch tip SHA.
- Discover the remote's current ref state via git-receive-pack.
- Fast-forward check (unless --force).
- Collect objects the remote does not yet have.
- Build a packfile containing those objects.
- Send the pkt-line update request + packfile via HTTP POST.
- Update the remote-tracking ref on success.
Types ¶
type Auth ¶
type Auth struct {
Username string
Password string // personal access token for GitHub/GitLab/Gitea etc.
}
Auth holds the credentials used for HTTP basic authentication.
type CloneOptions ¶
type CloneOptions struct {
// RemoteURL is the HTTPS URL of the repository to clone.
RemoteURL string
// Dir is the local destination directory. If empty, it is inferred
// from the last path segment of RemoteURL (stripping ".git").
Dir string
// Auth holds optional HTTP basic-auth credentials.
Auth *Auth
// Branch is the branch to check out after cloning. Defaults to the
// remote's HEAD branch (usually "main" or "master").
Branch string
}
CloneOptions holds all parameters for a clone operation.
type PushOptions ¶
type PushOptions struct {
// RemoteName is the name of the configured remote (e.g. "origin").
// If RemoteURL is also set, RemoteURL takes precedence.
RemoteName string
// RemoteURL overrides the URL looked up from config.
RemoteURL string
// Branch is the local branch to push. Defaults to the current branch.
Branch string
// Auth holds optional HTTP basic-auth credentials.
Auth *Auth
// Force skips the fast-forward check and forces the remote ref update.
Force bool
}
PushOptions holds all parameters for a push operation.
Click to show internal directories.
Click to hide internal directories.