MCPcopy
hub / github.com/jesseduffield/lazygit / dropMergeCommit

Function dropMergeCommit

pkg/utils/rebase_todo.go:310–320  ·  view source on GitHub ↗
(todos []todo.Todo, hash string)

Source from the content-addressed store, hash-verified

308}
309
310func dropMergeCommit(todos []todo.Todo, hash string) ([]todo.Todo, error) {
311 isMerge := func(t todo.Todo) bool {
312 return t.Command == todo.Merge && t.Flag == "-C" && equalHash(t.Commit, hash)
313 }
314 if lo.CountBy(todos, isMerge) != 1 {
315 return nil, fmt.Errorf("Expected exactly one merge commit with hash %s", hash)
316 }
317
318 _, idx, _ := lo.FindIndexOf(todos, isMerge)
319 return slices.Delete(todos, idx, idx+1), nil
320}

Callers 1

DropMergeCommitFunction · 0.85

Calls 3

equalHashFunction · 0.85
ErrorfMethod · 0.80
DeleteMethod · 0.45

Tested by

no test coverage detected