1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-02 03:37:14 +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 {
trimmedLine := strings.TrimPrefix(line, "++")
mapping := map[string]LineType{
"^<<<<<<< (HEAD|MERGE_HEAD|Updated upstream|ours)(:.+)?$": START,
"^=======$": MIDDLE,
"^>>>>>>> .*$": END,
switch {
case strings.HasPrefix(trimmedLine, "<<<<<<< "):
return START
case trimmedLine == "=======":
return MIDDLE
case strings.HasPrefix(trimmedLine, ">>>>>>> "):
return END
default:
return NOT_A_MARKER
}
for regexp_str, lineType := range mapping {
match, _ := regexp.MatchString(regexp_str, trimmedLine)
if match {
return lineType
}
}
return NOT_A_MARKER
}