gitapply

package
v0.0.0-...-ecf9bfd Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package gitapply provides "git apply" feautre.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(dst io.Writer, src io.ReaderAt, f *gitdiff.File, opts ApplyOptions) error

Apply applies the changes in f to src, writing the result to dst. It uses logic ported from Git's apply.c, supporting fuzz and context reduction.

func Parse

func Parse(r io.Reader) ([]*gitdiff.File, string, error)

Parse parses a patch from r. It currently delegates to gitdiff.Parse but is intended to eventually use logic ported from Git's apply.c.

func WriteRej

func WriteRej(w io.Writer, f *gitdiff.File, indices []int) error

WriteRej writes the rejected hunks of f to w.

Types

type ApplyOptions

type ApplyOptions struct {
	// Reject allows applying a patch with rejects, writing failed hunks to a .rej file.
	Reject bool
}

ApplyOptions defines options for patch application.

type RejectedError

type RejectedError struct {
	Indices []int
}

RejectedError indicates that some hunks of the patch were rejected.

func (*RejectedError) Error

func (e *RejectedError) Error() string

Jump to

Keyboard shortcuts

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