diff options
-rw-r--r-- | sequencer.c | 2 | ||||
-rwxr-xr-x | t/t3404-rebase-interactive.sh | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/sequencer.c b/sequencer.c index 4034c0461b..df11136f9d 100644 --- a/sequencer.c +++ b/sequencer.c @@ -741,7 +741,7 @@ static const char *read_author_ident(struct strbuf *buf) return NULL; } - buf->len = out - buf->buf; + strbuf_setlen(buf, out - buf->buf); return buf->buf; } diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 352a52e59d..347a09502e 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -1202,7 +1202,7 @@ rebase_setup_and_clean () { test_might_fail git branch -D $1 && test_might_fail git rebase --abort " && - git checkout -b $1 master + git checkout -b $1 ${2:-master} } test_expect_success 'drop' ' @@ -1379,4 +1379,12 @@ test_expect_success 'rebase -i --gpg-sign=<key-id> overrides commit.gpgSign' ' test_i18ngrep "$SQ-S\"S I Gner\"$SQ" err ' +test_expect_success 'valid author header after --root swap' ' + rebase_setup_and_clean author-header no-conflict-branch && + set_fake_editor && + FAKE_LINES="2 1" git rebase -i --root && + git cat-file commit HEAD^ >out && + grep "^author ..*> @[0-9][0-9]* [-+][0-9][0-9]*$" out +' + test_done |