diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-06-05 13:30:55 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-06-05 13:53:25 +1000 |
commit | f71b23b890014ce7eff01fd72ac50c672ed07ae9 (patch) | |
tree | 94ec1066616fd6073c4e63236e6c002aa1e191f8 /pkg/gui/mergeconflicts | |
parent | 05a23f0e1e6531e50beccc661b307fd6643d4431 (diff) |
more explicit
Diffstat (limited to 'pkg/gui/mergeconflicts')
-rw-r--r-- | pkg/gui/mergeconflicts/find_conflicts.go | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/pkg/gui/mergeconflicts/find_conflicts.go b/pkg/gui/mergeconflicts/find_conflicts.go index 2138215f1..848c05756 100644 --- a/pkg/gui/mergeconflicts/find_conflicts.go +++ b/pkg/gui/mergeconflicts/find_conflicts.go @@ -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 } |