Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-12-01 15:41:42 +0300
committerJunio C Hamano <gitster@pobox.com>2018-12-01 15:41:42 +0300
commit881d72eff8b0d23c8edc6f8d9673f8daafaace6f (patch)
tree9858e8976d76dce70351bced3cc5edb6ea3cf1bb /builtin
parent945f6bd1ce99b3c3576d52778055086caaed1fb8 (diff)
parent8797f0f008722537f56ed0bf16ebec45682b7497 (diff)
Merge branch 'js/rebase-stat-unrelated-fix'
"git rebase --stat" to transplant a piece of history onto a totally unrelated history were not working before and silently showed wrong result. With the recent reimplementation in C, it started to instead die with an error message, as the original logic was not prepared to cope with this case. This has now been fixed. * js/rebase-stat-unrelated-fix: rebase --stat: fix when rebasing to an unrelated history
Diffstat (limited to 'builtin')
-rw-r--r--builtin/rebase.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c
index ba0c3c954b..c87da417fb 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1503,10 +1503,15 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
if (options.flags & REBASE_DIFFSTAT) {
struct diff_options opts;
- if (options.flags & REBASE_VERBOSE)
- printf(_("Changes from %s to %s:\n"),
- oid_to_hex(&merge_base),
- oid_to_hex(&options.onto->object.oid));
+ if (options.flags & REBASE_VERBOSE) {
+ if (is_null_oid(&merge_base))
+ printf(_("Changes to %s:\n"),
+ oid_to_hex(&options.onto->object.oid));
+ else
+ printf(_("Changes from %s to %s:\n"),
+ oid_to_hex(&merge_base),
+ oid_to_hex(&options.onto->object.oid));
+ }
/* We want color (if set), but no pager */
diff_setup(&opts);
@@ -1516,8 +1521,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
opts.detect_rename = DIFF_DETECT_RENAME;
diff_setup_done(&opts);
- diff_tree_oid(&merge_base, &options.onto->object.oid,
- "", &opts);
+ diff_tree_oid(is_null_oid(&merge_base) ?
+ the_hash_algo->empty_tree : &merge_base,
+ &options.onto->object.oid, "", &opts);
diffcore_std(&opts);
diff_flush(&opts);
}