summaryrefslogtreecommitdiff
path: root/strbuf.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-11-02 11:04:54 +0900
committerJunio C Hamano <gitster@pobox.com>2018-11-02 11:04:54 +0900
commit39f73315454d2553b2d3219a58f5110a60eba5a1 (patch)
tree2a55eab60e69c17bba16f115e775ce1aacf49e6f /strbuf.c
parente0720a3867b85ad2fe0e92378973670b8b7f444b (diff)
parent0eabf4b95ca2d3213194de95cc9cd62593811965 (diff)
downloadgit-39f73315454d2553b2d3219a58f5110a60eba5a1.tar.gz
Merge branch 'pk/rebase-in-c-3-acts'
Rewrite "git rebase" in C. * pk/rebase-in-c-3-acts: builtin rebase: stop if `git am` is in progress builtin rebase: actions require a rebase in progress builtin rebase: support --edit-todo and --show-current-patch builtin rebase: support --quit builtin rebase: support --abort builtin rebase: support --skip builtin rebase: support --continue
Diffstat (limited to 'strbuf.c')
-rw-r--r--strbuf.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/strbuf.c b/strbuf.c
index 64041c3c24..f6a6cf78b9 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -120,6 +120,15 @@ void strbuf_trim_trailing_dir_sep(struct strbuf *sb)
sb->buf[sb->len] = '\0';
}
+void strbuf_trim_trailing_newline(struct strbuf *sb)
+{
+ if (sb->len > 0 && sb->buf[sb->len - 1] == '\n') {
+ if (--sb->len > 0 && sb->buf[sb->len - 1] == '\r')
+ --sb->len;
+ sb->buf[sb->len] = '\0';
+ }
+}
+
void strbuf_ltrim(struct strbuf *sb)
{
char *b = sb->buf;