From f95736288a3a8d0168af3fc05dc4251edf0d0b47 Mon Sep 17 00:00:00 2001 From: Pratik Karki Date: Wed, 8 Aug 2018 20:51:16 +0545 Subject: builtin rebase: support --continue This commit adds the option `--continue` which is used to resume rebase after merge conflicts. The code tries to stay as close to the equivalent shell scripts found in `git-legacy-rebase.sh` as possible. When continuing a rebase, the state variables are read from state_dir. Some of the state variables are not actually stored there, such as `upstream`. The shell script version simply does not set them, but for consistency, we unset them in the builtin version. Signed-off-by: Pratik Karki Signed-off-by: Junio C Hamano --- strbuf.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'strbuf.c') diff --git a/strbuf.c b/strbuf.c index 030556111d..fdc0ffbafb 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; -- cgit v1.2.1