remote

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2026 License: MIT Imports: 14 Imported by: 0

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:

  1. Resolve destination directory and create it.
  2. Initialise a fresh kitcat repo inside it.
  3. Discover remote refs via the smart HTTP protocol.
  4. Request all objects for the desired branch via git-upload-pack.
  5. Unpack the received packfile into the local object store.
  6. Write remote-tracking refs and the local branch pointer.
  7. Check out the working tree.
  8. 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:

  1. Resolve the remote URL from options or config.
  2. Resolve the local branch tip SHA.
  3. Discover the remote's current ref state via git-receive-pack.
  4. Fast-forward check (unless --force).
  5. Collect objects the remote does not yet have.
  6. Build a packfile containing those objects.
  7. Send the pkt-line update request + packfile via HTTP POST.
  8. 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.

type RefInfo

type RefInfo struct {
	SHA  string
	Name string
}

RefInfo describes a single reference advertised by a remote.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL