1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-17 00:18:05 +02:00

more explicit

This commit is contained in:
Jesse Duffield
2021-06-05 13:30:55 +10:00
parent 05a23f0e1e
commit f71b23b890

View File

@ -48,18 +48,14 @@ func findConflicts(content string) []*mergeConflict {
func determineLineType(line string) LineType { func determineLineType(line string) LineType {
trimmedLine := strings.TrimPrefix(line, "++") trimmedLine := strings.TrimPrefix(line, "++")
mapping := map[string]LineType{ switch {
"^<<<<<<< (HEAD|MERGE_HEAD|Updated upstream|ours)(:.+)?$": START, case strings.HasPrefix(trimmedLine, "<<<<<<< "):
"^=======$": MIDDLE, return START
"^>>>>>>> .*$": END, case trimmedLine == "=======":
} return MIDDLE
case strings.HasPrefix(trimmedLine, ">>>>>>> "):
for regexp_str, lineType := range mapping { return END
match, _ := regexp.MatchString(regexp_str, trimmedLine) default:
if match {
return lineType
}
}
return NOT_A_MARKER return NOT_A_MARKER
}
} }