aboutsummaryrefslogtreecommitdiff
path: root/ws.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-11-12 14:02:55 -0800
committerJunio C Hamano <gitster@pobox.com>2025-11-12 14:04:04 -0800
commita675104c399d242dd3ff5a0823fcd770563cf60f (patch)
treed4e1ffae50c2d596a5053fbb8b2bfada1c752a25 /ws.c
parent3a4eb5ad2e9166255d5921196470710523f24ec4 (diff)
downloadgit-a675104c399d242dd3ff5a0823fcd770563cf60f.tar.xz
whitespace: allocate a few more bits and define WS_INCOMPLETE_LINE
Reserve a few more bits in the diff flags word to be used for future whitespace rules. Add WS_INCOMPLETE_LINE without implementing the behaviour (yet). Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ws.c')
-rw-r--r--ws.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ws.c b/ws.c
index 70acee3337..34a7b4fad2 100644
--- a/ws.c
+++ b/ws.c
@@ -26,6 +26,7 @@ static struct whitespace_rule {
{ "blank-at-eol", WS_BLANK_AT_EOL, 0 },
{ "blank-at-eof", WS_BLANK_AT_EOF, 0 },
{ "tab-in-indent", WS_TAB_IN_INDENT, 0, 1 },
+ { "incomplete-line", WS_INCOMPLETE_LINE, 0, 0 },
};
unsigned parse_whitespace_rule(const char *string)
@@ -139,6 +140,11 @@ char *whitespace_error_string(unsigned ws)
strbuf_addstr(&err, ", ");
strbuf_addstr(&err, "tab in indent");
}
+ if (ws & WS_INCOMPLETE_LINE) {
+ if (err.len)
+ strbuf_addstr(&err, ", ");
+ strbuf_addstr(&err, "no newline at the end of file");
+ }
return strbuf_detach(&err, NULL);
}