summaryrefslogtreecommitdiffstats
path: root/services/gitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'services/gitdiff')
-rw-r--r--services/gitdiff/gitdiff.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/services/gitdiff/gitdiff.go b/services/gitdiff/gitdiff.go
index 0fcb361619..017341d63f 100644
--- a/services/gitdiff/gitdiff.go
+++ b/services/gitdiff/gitdiff.go
@@ -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 ""
}