forked from forgejo/forgejo
Added auto-save whitespace behavior if it changed manually (#15566)
This commit is contained in:
parent
60f203385e
commit
4d939845d2
4 changed files with 33 additions and 9 deletions
|
@ -1532,13 +1532,17 @@ func CommentMustAsDiff(c *models.Comment) *Diff {
|
|||
}
|
||||
|
||||
// GetWhitespaceFlag returns git diff flag for treating whitespaces
|
||||
func GetWhitespaceFlag(whiteSpaceBehavior string) string {
|
||||
func GetWhitespaceFlag(whitespaceBehavior string) string {
|
||||
whitespaceFlags := map[string]string{
|
||||
"ignore-all": "-w",
|
||||
"ignore-change": "-b",
|
||||
"ignore-eol": "--ignore-space-at-eol",
|
||||
"": "",
|
||||
"show-all": "",
|
||||
}
|
||||
|
||||
return whitespaceFlags[whiteSpaceBehavior]
|
||||
if flag, ok := whitespaceFlags[whitespaceBehavior]; ok {
|
||||
return flag
|
||||
}
|
||||
log.Warn("unknown whitespace behavior: %q, default to 'show-all'", whitespaceBehavior)
|
||||
return ""
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue