Help us shape the future of Go! Take the 2026 Go Developer Survey

mergeconflicts

package
v0.63.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CONFLICT_START       = "<<<<<<< "
	CONFLICT_END         = ">>>>>>> "
	CONFLICT_START_BYTES = []byte(CONFLICT_START)
	CONFLICT_END_BYTES   = []byte(CONFLICT_END)
)

Functions

func ColoredConflictFile

func ColoredConflictFile(state *State) string

func FileHasConflictMarkers added in v0.35.0

func FileHasConflictMarkers(path string) (bool, error)

tells us whether a file actually has inline merge conflicts. We need to run this because git will continue showing a status of 'UU' even after the conflicts have been resolved in the user's editor

Types

type LineType added in v0.28.2

type LineType int

LineType tells us whether a given line is a start/middle/end marker of a conflict, or if it's not a marker at all

const (
	START LineType = iota
	ANCESTOR
	TARGET
	END
	NOT_A_MARKER
)

type Selection

type Selection int
const (
	TOP Selection = iota
	MIDDLE
	BOTTOM
	BOTH
)

type State added in v0.28.1

type State struct {
	// contains filtered or unexported fields
}

State represents the selection state of the merge conflict context.

func NewState added in v0.28.1

func NewState() *State

func (*State) Active added in v0.35.0

func (s *State) Active() bool

func (*State) AllConflictsResolved added in v0.35.0

func (s *State) AllConflictsResolved() bool

func (*State) ContentAfterConflictResolve added in v0.28.1

func (s *State) ContentAfterConflictResolve(selection Selection) (bool, string, error)

func (*State) GetConflictMiddle added in v0.28.1

func (s *State) GetConflictMiddle() int

func (*State) GetContent added in v0.35.0

func (s *State) GetContent() string

func (*State) GetPath added in v0.35.0

func (s *State) GetPath() string

func (*State) GetSelectedLine added in v0.35.0

func (s *State) GetSelectedLine() int

func (*State) GetSelectedRange added in v0.38.0

func (s *State) GetSelectedRange() (int, int)

func (*State) NoConflicts added in v0.28.1

func (s *State) NoConflicts() bool

func (*State) PlainRenderSelected added in v0.38.0

func (s *State) PlainRenderSelected() string

func (*State) PushContent added in v0.35.0

func (s *State) PushContent(content string)

this is for when you've resolved a conflict. This allows you to undo to a previous state

func (*State) Reset added in v0.28.1

func (s *State) Reset()

func (*State) ResetConflictSelection added in v0.36.0

func (s *State) ResetConflictSelection()

we're not resetting selectedIndex here because the user typically would want to pick either all top hunks or all bottom hunks so we retain that selection

func (*State) SelectNextConflict added in v0.28.1

func (s *State) SelectNextConflict()

func (*State) SelectNextConflictHunk added in v0.30.1

func (s *State) SelectNextConflictHunk()

func (*State) SelectPrevConflict added in v0.28.1

func (s *State) SelectPrevConflict()

func (*State) SelectPrevConflictHunk added in v0.30.1

func (s *State) SelectPrevConflictHunk()

func (*State) Selection added in v0.28.1

func (s *State) Selection() Selection

func (*State) SetContent added in v0.35.0

func (s *State) SetContent(content string, path string)

this is for starting a new merge conflict session

func (*State) Undo added in v0.35.0

func (s *State) Undo() bool

Jump to

Keyboard shortcuts

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