diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-11-02 11:04:54 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-11-02 11:04:54 +0900 |
commit | 39f73315454d2553b2d3219a58f5110a60eba5a1 (patch) | |
tree | 2a55eab60e69c17bba16f115e775ce1aacf49e6f /strbuf.c | |
parent | e0720a3867b85ad2fe0e92378973670b8b7f444b (diff) | |
parent | 0eabf4b95ca2d3213194de95cc9cd62593811965 (diff) | |
download | git-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.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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; |