(todos []todo.Todo, hash string)
| 308 | } |
| 309 | |
| 310 | func 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 | } |
no test coverage detected