mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
Make equalHash more correct
So far it didn't have to handle the case where one hash is empty and the other isn't, but in the next commit we need that, so let's handle that case correctly. There's enough logic in the function now that it's worth covering it with tests.
This commit is contained in:
@ -56,7 +56,12 @@ func EditRebaseTodo(filePath string, changes []TodoChange, commentChar byte) err
|
||||
}
|
||||
|
||||
func equalHash(a, b string) bool {
|
||||
return strings.HasPrefix(a, b) || strings.HasPrefix(b, a)
|
||||
if len(a) == 0 && len(b) == 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
commonLength := min(len(a), len(b))
|
||||
return commonLength > 0 && a[:commonLength] == b[:commonLength]
|
||||
}
|
||||
|
||||
func findTodo(todos []todo.Todo, todoToFind Todo) (int, bool) {
|
||||
|
Reference in New Issue
Block a user