nanogit

package module
v0.0.0-...-66b7bcf Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

README

nanogit

License Go Report Card GoDoc codecov

Overview

nanogit is a lightweight, cloud-native Git implementation designed for applications that need efficient Git operations over HTTPS without the complexity and resource overhead of traditional Git implementations.

Features

  • HTTPS-only Git operations - Works with any Git service supporting Smart HTTP Protocol v2 (GitHub, GitLab, Bitbucket, etc.), eliminating the need for SSH key management in cloud environments

  • Stateless architecture - No local .git directory dependency, making it perfect for serverless functions, containers, and microservices where persistent local state isn't available or desired

  • Memory-optimized design - Streaming packfile operations and configurable writing modes minimize memory usage, crucial for bulk operations and memory-constrained environments

  • Flexible storage architecture - Pluggable object storage and configurable writing modes allow optimization for different deployment patterns, from high-performance in-memory operations to memory-efficient disk-based processing

  • Cloud-native authentication - Built-in support for Basic Auth and API tokens, designed for automated workflows and CI/CD systems without interactive authentication

  • Essential Git operations - Focused on core functionality (read/write objects, commit operations, diffing) without the complexity of full Git implementations, reducing attack surface and resource requirements

  • High performance - Significantly faster than traditional Git implementations for common cloud operations, with up to 300x speed improvements for certain scenarios

Non-Goals

The following features are explicitly not supported:

  • git:// and Git-over-SSH protocols
  • File protocol (local Git operations)
  • Commit signing and signature verification
  • Full Git clones
  • Git hooks
  • Git configuration management
  • Direct .git directory access
  • "Dumb" servers
  • Complex permissions (all objects use mode 0644)

Why nanogit?

While go-git is a mature Git implementation, nanogit is designed for cloud-native, multitenant environments requiring minimal, stateless operations.

Feature nanogit go-git
Protocol HTTPS-only All protocols
Storage Stateless, configurable object storage + writing modes Local disk operations
Scope Essential operations only Full Git functionality
Use Case Cloud services, multitenant General purpose
Resource Usage Minimal footprint Full Git features

Choose nanogit for lightweight cloud services requiring stateless operations and minimal resources. Use go-git when you need full Git functionality, local operations, or advanced features.

This are some of the performance differences between nanogit and go-git in some of the measured scenarios:

Scenario Speed Memory Usage
CreateFile (XL repo) 306x faster 186x less
UpdateFile (XL repo) 291x faster 178x less
DeleteFile (XL repo) 302x faster 175x less
BulkCreateFiles (1000 files, medium repo) 607x faster 11x less
CompareCommits (XL repo) 60x faster 96x less
GetFlatTree (XL repo) 258x faster 160x less

For detailed performance metrics, see the latest performance report and performance analysis.

Getting Started

Prerequisites
  • Go 1.24 or later.
  • Git (for development)
Installation
go get github.com/grafana/nanogit
Usage
// Create client with authentication
client, err := nanogit.NewHTTPClient(
    "https://github.com/user/repo.git",
    options.WithBasicAuth("username", "token"),
)

// Get main branch and create staged writer
ref, err := client.GetRef(ctx, "refs/heads/main")
writer, err := client.NewStagedWriter(ctx, ref)

// Create and update files
writer.CreateBlob(ctx, "docs/new-feature.md", []byte("# New Feature"))
writer.UpdateBlob(ctx, "README.md", []byte("Updated content"))

// Commit changes with proper author/committer info
author := nanogit.Author{
    Name:  "John Doe",
    Email: "john@example.com",
    Time:  time.Now(),
}
committer := nanogit.Committer{
    Name:  "Deploy Bot",
    Email: "deploy@example.com",
    Time:  time.Now(),
}

commit, err := writer.Commit(ctx, "Add feature and update docs", author, committer)
writer.Push(ctx)
Configurable Writing Modes

nanogit provides flexible writing modes to optimize memory usage during write operations:

// Auto mode (default) - smart memory/disk switching
writer, err := client.NewStagedWriter(ctx, ref)

// Memory mode - maximum performance
writer, err := client.NewStagedWriter(ctx, ref, nanogit.WithMemoryStorage())

// Disk mode - minimal memory usage for bulk operations
writer, err := client.NewStagedWriter(ctx, ref, nanogit.WithDiskStorage())

For detailed information about writing modes, performance characteristics, and use cases, see Storage Architecture Documentation.

Storage Architecture

nanogit features a flexible two-layer storage architecture that separates concerns and allows independent optimization:

  1. Writing modes: Control temporary storage during packfile creation (memory/disk/auto)
  2. Object storage: Handle long-term caching and retrieval of Git objects (pluggable backends)
Object Storage and Caching

nanogit provides context-based object storage with pluggable backends. The default in-memory implementation is optimized for stateless operations, but you can implement custom backends for persistent caching:

// Custom storage example
ctx = storage.ToContext(ctx, myRedisStorage)
client, err := nanogit.NewHTTPClient(repo, options...)

This enables sharing Git object cache across multiple repositories, persistent caching across service restarts, and optimization for specific deployment patterns.

For detailed information about storage architecture, writing modes, and custom implementations, see Storage Architecture Documentation.

Testing

nanogit includes generated mocks for easy unit testing. The mocks are generated using counterfeiter and provide comprehensive test doubles for both the Client and StagedWriter interfaces.

For detailed testing examples and instructions, see CONTRIBUTING.md. You can also find complete working examples in mocks/example_test.go.

Contributing

We welcome contributions! Please see our Contributing Guide for details on how to submit pull requests, report issues, and set up your development environment.

Code of Conduct

This project follows the Grafana Code of Conduct. By participating, you are expected to uphold this code.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Project Status

This project is currently in active development. While it's open source, it's important to note that it was initially created as part of a hackathon. We're working to make it production-ready, but please use it with appropriate caution.

Resources

Want to learn how Git works? The following resources are useful:

Security

If you find a security vulnerability, please report it to security@grafana.com. For more information, see our Security Policy.

Support

Acknowledgments

  • The Grafana team for their support and guidance
  • The open source community for their valuable feedback and contributions

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrObjectNotFound is returned when a requested Git object cannot be found in the repository.
	// This error should only be used with errors.Is() for comparison, not for type assertions.
	ErrObjectNotFound = errors.New("object not found")

	// ErrObjectAlreadyExists is returned when attempting to create a Git object that already exists.
	// This error should only be used with errors.Is() for comparison, not for type assertions.
	ErrObjectAlreadyExists = errors.New("object already exists")

	// ErrUnexpectedObjectType is returned when a Git object has a different type than expected.
	// This error should only be used with errors.Is() for comparison, not for type assertions.
	ErrUnexpectedObjectType = errors.New("unexpected object type")

	// ErrNothingToPush is returned when attempting to push changes but no objects have been staged.
	// This error should only be used with errors.Is() for comparison, not for type assertions.
	ErrNothingToPush = errors.New("nothing to push")

	// ErrNothingToCommit is returned when attempting to commit but no changes have been staged.
	// This error should only be used with errors.Is() for comparison, not for type assertions.
	ErrNothingToCommit = errors.New("nothing to commit")

	// ErrUnexpectedObjectCount is returned when the number of objects returned by the server is unexpected.
	// This error should only be used with errors.Is() for comparison, not for type assertions.
	ErrUnexpectedObjectCount = errors.New("unexpected object count")

	// ErrEmptyCommitMessage is returned when attempting to create a commit with an empty message.
	// This error should only be used with errors.Is() for comparison, not for type assertions.
	ErrEmptyCommitMessage = errors.New("empty commit message")

	// ErrEmptyPath is returned when a path is empty.
	// This error should only be used with errors.Is() for comparison, not for type assertions.
	ErrEmptyPath = errors.New("empty path")

	// ErrEmptyRefName is returned when a ref name is empty.
	// This error should only be used with errors.Is() for comparison, not for type assertions.
	ErrEmptyRefName = errors.New("empty ref name")

	// ErrInvalidAuthor is returned when author information is invalid.
	// This error should only be used with errors.Is() for comparison, not for type assertions.
	ErrInvalidAuthor = errors.New("invalid author information")
)
View Source
var ErrWriterCleanedUp = errors.New("writer has been cleaned up and can no longer be used")

ErrWriterCleanedUp is returned when trying to use a writer after cleanup has been called.

Functions

This section is empty.

Types

type Author

type Author struct {
	// Name is the full name of the author (e.g., "John Doe")
	Name string
	// Email is the email address of the author (e.g., "john@example.com")
	Email string
	// Time is when the changes were originally made by the author
	Time time.Time
}

Author represents the person who created the changes in the commit. It includes their name, email, and the timestamp of when they made the changes. This is typically the person who wrote the code or made the modifications.

type AuthorError

type AuthorError struct {
	Field  string
	Reason string
}

AuthorError provides structured information about invalid author information.

func NewAuthorError

func NewAuthorError(field, reason string) *AuthorError

NewAuthorError creates a new AuthorError with the specified details.

func (*AuthorError) Error

func (e *AuthorError) Error() string

func (*AuthorError) Unwrap

func (e *AuthorError) Unwrap() error

type Blob

type Blob struct {
	// Hash is the SHA-1 hash of the blob object
	Hash hash.Hash
	// Content is the raw file content as bytes
	Content []byte
}

Blob represents a Git blob object, which stores the content of a file. In Git, all file content is stored as blob objects in the object database.

type Client

type Client interface {
	// Repo operations
	IsAuthorized(ctx context.Context) (bool, error)
	RepoExists(ctx context.Context) (bool, error)
	// Ref operations
	ListRefs(ctx context.Context) ([]Ref, error)
	GetRef(ctx context.Context, refName string) (Ref, error)
	CreateRef(ctx context.Context, ref Ref) error
	UpdateRef(ctx context.Context, ref Ref) error
	DeleteRef(ctx context.Context, refName string) error
	// Blob operations
	GetBlob(ctx context.Context, hash hash.Hash) (*Blob, error)
	GetBlobByPath(ctx context.Context, rootHash hash.Hash, path string) (*Blob, error)
	// Tree operations
	GetFlatTree(ctx context.Context, hash hash.Hash) (*FlatTree, error)
	GetTree(ctx context.Context, hash hash.Hash) (*Tree, error)
	GetTreeByPath(ctx context.Context, rootHash hash.Hash, path string) (*Tree, error)
	// Commit operations
	GetCommit(ctx context.Context, hash hash.Hash) (*Commit, error)
	CompareCommits(ctx context.Context, baseCommit, headCommit hash.Hash) ([]CommitFile, error)
	ListCommits(ctx context.Context, startCommit hash.Hash, options ListCommitsOptions) ([]Commit, error)
	// Write operations
	NewStagedWriter(ctx context.Context, ref Ref, options ...WriterOption) (StagedWriter, error)
}

Client defines the interface for interacting with a Git repository. It provides methods for repository operations, reference management,

func NewHTTPClient

func NewHTTPClient(repo string, options ...options.Option) (Client, error)

NewHTTPClient creates a new Git client for the specified repository URL. The client implements the Git Smart Protocol version 2 over HTTP/HTTPS transport. It supports both HTTP and HTTPS URLs and can be configured with various options for authentication, logging, and HTTP client customization.

Parameters:

  • repo: Repository URL (must be HTTP or HTTPS)
  • options: Configuration options for authentication, logging, etc.

Returns:

  • Client: Configured Git client interface
  • error: Error if URL is invalid or configuration fails

Example:

// Create client with basic authentication
client, err := nanogit.NewHTTPClient(
    "https://github.com/user/repo",
    options.WithBasicAuth("username", "password"),
    options.WithLogger(logger),
)
if err != nil {
    return err
}

type Commit

type Commit struct {
	// Hash is the SHA-1 hash of the commit object
	Hash hash.Hash
	// Tree is the hash of the root tree object that represents the state
	// of the repository at the time of the commit
	Tree hash.Hash
	// Parent is the hash of the parent commit
	// TODO: Merge commits can have multiple parents, but currently only single parent is supported
	Parent hash.Hash
	// Author is the person who created the changes in the commit
	Author Author
	// Committer is the person who created the commit object
	Committer Committer
	// Message is the commit message that describes the changes made in this commit
	Message string
}

Commit represents a Git commit object. It contains metadata about the commit, including the author, committer, commit message, and references to the parent commits and tree.

func (*Commit) Time

func (c *Commit) Time() time.Time

Time returns the timestamp when the commit object was created. This is equivalent to the committer's timestamp, as the committer is the person who actually created the commit object in the repository. For most commits, this will be the same as the author time, but they can differ in some workflows.

Returns:

  • time.Time: The timestamp when the commit was created

type CommitFile

type CommitFile struct {
	// Path of the file in the head commit
	Path string
	// Mode is the file mode in the head commit (e.g., 100644 for regular files)
	Mode uint32
	// OldMode is the original file mode in the base commit (for modified files)
	OldMode uint32
	// Hash is the file hash in the head commit
	Hash hash.Hash
	// OldHash is the original file hash in the base commit (for modified files)
	OldHash hash.Hash
	// Status indicates the type of file change (added, modified, deleted, etc.)
	Status protocol.FileStatus
}

CommitFile represents a file change between two commits. It contains information about how a file was modified, including its path, mode, hash, and the type of change (added, modified, deleted, etc.).

type Committer

type Committer struct {
	// Name is the full name of the committer (e.g., "Jane Smith")
	Name string
	// Email is the email address of the committer (e.g., "jane@example.com")
	Email string
	// Time is when the commit object was created
	Time time.Time
}

Committer represents the person who created the commit object. This is often the same as the author, but can be different in cases where someone else commits changes on behalf of the author (e.g., via patches).

type FlatTree

type FlatTree struct {
	// Entries contains all files and directories in the tree (recursive)
	Entries []FlatTreeEntry
	// Hash is the SHA-1 hash of the root tree object
	Hash hash.Hash
}

FlatTree represents a recursive, flattened view of a Git tree structure. This provides a complete list of all files and directories in the tree, with each entry containing its full path from the repository root.

This is useful for operations that need to:

  • List all files in a repository
  • Search for specific files by path
  • Compare entire directory structures
  • Generate file listings for display

type FlatTreeEntry

type FlatTreeEntry struct {
	// Name is the base filename (e.g., "file.txt")
	Name string
	// Path is the full path from repository root (e.g., "dir/subdir/file.txt")
	Path string
	// Mode is the file mode in octal (e.g., 0o100644 for regular files, 0o40000 for directories)
	Mode uint32
	// Hash is the SHA-1 hash of the object
	Hash hash.Hash
	// Type is the type of Git object (blob for files, tree for directories)
	Type protocol.ObjectType
}

FlatTreeEntry represents a single entry in a flattened Git tree structure. Unlike TreeEntry, this includes the full path from the repository root, making it suitable for operations that need to work with complete file paths.

A flattened tree contains all files and directories recursively, with each entry having its complete path from the repository root.

type ListCommitsOptions

type ListCommitsOptions struct {
	// PerPage specifies the number of commits to return per page
	// If 0, defaults to 30. Maximum allowed is 100
	PerPage int
	// Page specifies which page of results to return (1-based)
	// If 0, defaults to 1
	Page int
	// Path filters commits to only those that affect the specified file or directory path
	// If empty, all commits are included
	Path string
	// Since filters commits to only those created after this time
	// If zero, no time filtering is applied
	Since time.Time
	// Until filters commits to only those created before this time
	// If zero, no time filtering is applied
	Until time.Time
}

ListCommitsOptions provides filtering and pagination options for listing commits. Similar to GitHub's API, it allows limiting results, filtering by path, and pagination.

type ObjectAlreadyExistsError

type ObjectAlreadyExistsError struct {
	ObjectID hash.Hash
}

ObjectAlreadyExistsError provides structured information about a Git object that already exists.

func NewObjectAlreadyExistsError

func NewObjectAlreadyExistsError(objectID hash.Hash) *ObjectAlreadyExistsError

NewObjectAlreadyExistsError creates a new ObjectAlreadyExistsError with the specified object ID.

func (*ObjectAlreadyExistsError) Error

func (e *ObjectAlreadyExistsError) Error() string

func (*ObjectAlreadyExistsError) Unwrap

func (e *ObjectAlreadyExistsError) Unwrap() error

Unwrap enables errors.Is() compatibility with ErrObjectAlreadyExists

type ObjectNotFoundError

type ObjectNotFoundError struct {
	ObjectID hash.Hash
}

ObjectNotFoundError provides structured information about a Git object that was not found.

func NewObjectNotFoundError

func NewObjectNotFoundError(objectID hash.Hash) *ObjectNotFoundError

NewObjectNotFoundError creates a new ObjectNotFoundError with the specified object ID.

func (*ObjectNotFoundError) Error

func (e *ObjectNotFoundError) Error() string

func (*ObjectNotFoundError) Unwrap

func (e *ObjectNotFoundError) Unwrap() error

Unwrap enables errors.Is() compatibility with ErrObjectNotFound

type PackfileStorageMode

type PackfileStorageMode int

PackfileStorageMode defines how packfile objects are stored during staging.

const (
	// PackfileStorageAuto automatically chooses between memory and disk based on object count.
	// Uses memory for small operations (<=10 objects) and disk for larger operations.
	PackfileStorageAuto PackfileStorageMode = iota

	// PackfileStorageMemory always stores objects in memory for maximum performance.
	// Best for small operations but can use significant memory for bulk operations.
	PackfileStorageMemory

	// PackfileStorageDisk always stores objects in temporary files on disk.
	// Best for bulk operations to minimize memory usage.
	PackfileStorageDisk
)

type PathNotFoundError

type PathNotFoundError struct {
	Path string
}

PathNotFoundError provides structured information about a Git path that was not found.

func NewPathNotFoundError

func NewPathNotFoundError(path string) *PathNotFoundError

NewPathNotFoundError creates a new PathNotFoundError with the specified path.

func (*PathNotFoundError) Error

func (e *PathNotFoundError) Error() string

func (*PathNotFoundError) Unwrap

func (e *PathNotFoundError) Unwrap() error

Unwrap enables errors.Is() compatibility with ErrPathNotFound

type Ref

type Ref struct {
	// Name is the full reference name (e.g., "refs/heads/main", "refs/tags/v1.0")
	Name string
	// Hash is the commit hash that this reference points to
	Hash hash.Hash
}

Ref represents a Git reference (ref) in the repository. A ref is a pointer to a specific commit in the repository's history. Common reference types include branches (refs/heads/*), tags (refs/tags/*), and remote tracking branches (refs/remotes/*).

type RefAlreadyExistsError

type RefAlreadyExistsError struct {
	RefName string
}

RefAlreadyExistsError provides structured information about a Git reference that already exists.

func NewRefAlreadyExistsError

func NewRefAlreadyExistsError(refName string) *RefAlreadyExistsError

NewRefAlreadyExistsError creates a new RefAlreadyExistsError with the specified reference name.

func (*RefAlreadyExistsError) Error

func (e *RefAlreadyExistsError) Error() string

func (*RefAlreadyExistsError) Unwrap

func (e *RefAlreadyExistsError) Unwrap() error

Unwrap enables errors.Is() compatibility with ErrObjectAlreadyExists

type RefNotFoundError

type RefNotFoundError struct {
	RefName string
}

RefNotFoundError provides structured information about a Git reference that was not found.

func NewRefNotFoundError

func NewRefNotFoundError(refName string) *RefNotFoundError

NewRefNotFoundError creates a new RefNotFoundError with the specified reference name.

func (*RefNotFoundError) Error

func (e *RefNotFoundError) Error() string

func (*RefNotFoundError) Unwrap

func (e *RefNotFoundError) Unwrap() error

Unwrap enables errors.Is() compatibility with ErrRefNotFound

type StagedWriter

type StagedWriter interface {
	// BlobExists checks if a blob exists at the given path.
	BlobExists(ctx context.Context, path string) (bool, error)

	// CreateBlob stages a new file to be written at the given path.
	// Returns the hash of the created blob.
	CreateBlob(ctx context.Context, path string, content []byte) (hash.Hash, error)

	// UpdateBlob stages an update to an existing file at the given path.
	// Returns the hash of the updated blob.
	UpdateBlob(ctx context.Context, path string, content []byte) (hash.Hash, error)

	// DeleteBlob stages the deletion of a file at the given path.
	// Returns the hash of the tree after deletion.
	DeleteBlob(ctx context.Context, path string) (hash.Hash, error)

	// GetTree gets the tree object at the given path.
	GetTree(ctx context.Context, path string) (*Tree, error)

	// DeleteTree stages the deletion of a directory and all its contents at the given path.
	// Returns the hash of the deleted tree.
	DeleteTree(ctx context.Context, path string) (hash.Hash, error)

	// Commit creates a new commit with all staged changes.
	// Returns the hash of the created commit.
	Commit(ctx context.Context, message string, author Author, committer Committer) (*Commit, error)

	// Push sends all committed changes to the remote repository.
	// This is the final step that makes changes visible to others.
	// It will update the reference to point to the last commit.
	Push(ctx context.Context) error

	// Cleanup releases any resources held by the writer and clears all staged changes.
	// This should be called when the writer is no longer needed or to cancel all pending changes.
	// After calling Cleanup, the writer should not be used for further operations.
	Cleanup(ctx context.Context) error
}

StagedWriter provides a transactional interface for writing changes to Git objects. It allows staging multiple changes (file writes, updates, deletes) before committing them together. Changes are staged in memory and only sent to the server when Push() is called. This can be used to write to any Git object: commits, tags, branches, or other references.

type Tree

type Tree struct {
	// Entries contains the direct children of this tree (non-recursive)
	Entries []TreeEntry
	// Hash is the SHA-1 hash of this tree object
	Hash hash.Hash
}

Tree represents a single Git tree object containing direct children only. This provides a non-recursive view of a directory, showing only the immediate files and subdirectories within it.

This is useful for operations that need to:

  • Browse directory contents one level at a time
  • Implement tree navigation interfaces
  • Work with specific directory levels
  • Minimize memory usage when not all files are needed

type TreeEntry

type TreeEntry struct {
	// Name is the filename or directory name
	Name string
	// Mode is the file mode in octal (e.g., 0o100644 for files, 0o40000 for directories)
	Mode uint32
	// Hash is the SHA-1 hash of the object
	Hash hash.Hash
	// Type is the type of Git object (blob for files, tree for directories)
	Type protocol.ObjectType
}

TreeEntry represents a single entry in a Git tree object. This contains only direct children of the tree (non-recursive), similar to what you'd see with 'ls' in a directory.

type UnexpectedObjectCountError

type UnexpectedObjectCountError struct {
	ExpectedCount int
	ActualCount   int
	Objects       []*protocol.PackfileObject
}

UnexpectedObjectCountError provides structured information about a Git object with an unexpected count.

func NewUnexpectedObjectCountError

func NewUnexpectedObjectCountError(expectedCount int, objects []*protocol.PackfileObject) *UnexpectedObjectCountError

NewUnexpectedObjectCountError creates a new UnexpectedObjectCountError with the specified details.

func (*UnexpectedObjectCountError) Error

func (*UnexpectedObjectCountError) Unwrap

func (e *UnexpectedObjectCountError) Unwrap() error

Unwrap enables errors.Is() compatibility with ErrUnexpectedObjectCount

type UnexpectedObjectTypeError

type UnexpectedObjectTypeError struct {
	ObjectID     hash.Hash
	ExpectedType protocol.ObjectType
	ActualType   protocol.ObjectType
}

UnexpectedObjectTypeError provides structured information about a Git object with an unexpected type.

func NewUnexpectedObjectTypeError

func NewUnexpectedObjectTypeError(objectID hash.Hash, expectedType, actualType protocol.ObjectType) *UnexpectedObjectTypeError

NewUnexpectedObjectTypeError creates a new UnexpectedObjectTypeError with the specified details.

func (*UnexpectedObjectTypeError) Error

func (e *UnexpectedObjectTypeError) Error() string

func (*UnexpectedObjectTypeError) Unwrap

func (e *UnexpectedObjectTypeError) Unwrap() error

Unwrap enables errors.Is() compatibility with ErrUnexpectedObjectType

type WriterOption

type WriterOption func(*WriterOptions) error

WriterOption is a function type for configuring WriterOptions.

func WithAutoStorage

func WithAutoStorage() WriterOption

WithAutoStorage configures the writer to automatically choose between memory and disk based on the number of objects. This is the default behavior.

func WithDiskStorage

func WithDiskStorage() WriterOption

WithDiskStorage configures the writer to always use disk storage for packfile objects. This minimizes memory usage but may be slightly slower due to disk I/O.

func WithMemoryStorage

func WithMemoryStorage() WriterOption

WithMemoryStorage configures the writer to always use in-memory storage for packfile objects. This provides the best performance but can use significant memory for bulk operations.

type WriterOptions

type WriterOptions struct {
	// StorageMode determines how packfile objects are stored during staging.
	// Default is PackfileStorageAuto.
	StorageMode PackfileStorageMode
}

WriterOptions holds configuration options for StagedWriter.

Directories

Path Synopsis
log
mocks
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
Package object defines the types of objects that can be stored in a Git repository.
Package object defines the types of objects that can be stored in a Git repository.
hash
A Git-oriented hashing implementation.
A Git-oriented hashing implementation.

Jump to

Keyboard shortcuts

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