mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-13 00:07:59 +02:00
more explicit
This commit is contained in:
parent
05a23f0e1e
commit
f71b23b890
@ -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, ">>>>>>> "):
|
||||||
|
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
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user