]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/rebase.c
rebase --stat: fix when rebasing to an unrelated history
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 29 Nov 2018 13:01:54 +0000 (05:01 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 30 Nov 2018 05:43:00 +0000 (14:43 +0900)
commit8797f0f008722537f56ed0bf16ebec45682b7497
treedd777f011f7058ac6521de61642f2d942867bac9
parent7068cbc4abac53d9c3675dfba81c1e97d25e8eeb
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>
builtin/rebase.c
git-legacy-rebase.sh
t/t3406-rebase-message.sh