diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2018-11-29 05:01:54 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-11-30 14:43:00 +0900 |
commit | 8797f0f008722537f56ed0bf16ebec45682b7497 (patch) | |
tree | dd777f011f7058ac6521de61642f2d942867bac9 /t/t3406-rebase-message.sh | |
parent | Merge branch 'ja/i18n-fix' (diff) | |
download | tgif-8797f0f008722537f56ed0bf16ebec45682b7497.tar.xz |
rebase --stat: fix when rebasing to an unrelated history
When rebasing to a commit history that has no common commits with the
current branch, there is no merge base. In diffstat mode, this means
that we cannot compare to the merge base, but we have to compare to the
empty tree instead.
Also, if running in verbose diffstat mode, we should not output
Changes from <merge-base> to <onto>
as that does not make sense without any merge base.
Note: neither scripted nor built-in versoin of `git rebase` were
prepared for this situation well. We use this opportunity not only to
fix the bug(s), but also to make both versions' output consistent in
this instance. And add a regression test to keep this working in all
eternity.
Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3406-rebase-message.sh')
-rwxr-xr-x | t/t3406-rebase-message.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh index 38bd876cab..c2c9950568 100755 --- a/t/t3406-rebase-message.sh +++ b/t/t3406-rebase-message.sh @@ -91,4 +91,14 @@ test_expect_success 'error out early upon -C<n> or --whitespace=<bad>' ' test_i18ngrep "Invalid whitespace option" err ' +test_expect_success 'rebase -i onto unrelated history' ' + git init unrelated && + test_commit -C unrelated 1 && + git -C unrelated remote add -f origin "$PWD" && + git -C unrelated branch --set-upstream-to=origin/master && + git -C unrelated -c core.editor=true rebase -i -v --stat >actual && + test_i18ngrep "Changes to " actual && + test_i18ngrep "5 files changed" actual +' + test_done |