rebase: rename merge_base to branch_base
merge_base is not a very descriptive name, the variable always holds the merge-base of 'branch' and 'onto' which is commit at the base of the branch being rebased so rename it to branch_base. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood committed
Oct 17, 2022 at 13:17 UTC
a77060218dfae5e8209a0ee131f292b881ce533b
1 file changed
+15
-15
builtin/rebase.c
+15
-15
@@ -860,22 +860,22 @@ static int is_linear_history(struct commit *from, struct commit *to)
860
861
static int can_fast_forward(struct commit *onto, struct commit *upstream,
862
struct commit *restrict_revision,
863
- struct commit *head, struct object_id *merge_base)
863
+ struct commit *head, struct object_id *branch_base)
864
{
865
struct commit_list *merge_bases = NULL;
866
int res = 0;
867
868
merge_bases = get_merge_bases(onto, head);
869
if (!merge_bases || merge_bases->next) {
870
- oidcpy(merge_base, null_oid());
870
+ oidcpy(branch_base, null_oid());
871
goto done;
872
}
873
874
- oidcpy(merge_base, &merge_bases->item->object.oid);
875
- if (!oideq(merge_base, &onto->object.oid))
874
+ oidcpy(branch_base, &merge_bases->item->object.oid);
875
+ if (!oideq(branch_base, &onto->object.oid))
876
goto done;
877
878
- if (restrict_revision && !oideq(&restrict_revision->object.oid, merge_base))
878
+ if (restrict_revision && !oideq(&restrict_revision->object.oid, branch_base))
879
goto done;
880
881
if (!upstream)
@@ -1029,7 +1029,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1029
struct strbuf msg = STRBUF_INIT;
1030
struct strbuf revisions = STRBUF_INIT;
1031
struct strbuf buf = STRBUF_INIT;
1032
- struct object_id merge_base;
1032
+ struct object_id branch_base;
1033
int ignore_whitespace = 0;
1034
enum action action = ACTION_NONE;
1035
const char *gpg_sign = NULL;
@@ -1644,7 +1644,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1644
} else if (!options.onto_name)
1645
options.onto_name = options.upstream_name;
1646
if (strstr(options.onto_name, "...")) {
1647
- if (get_oid_mb(options.onto_name, &merge_base) < 0) {
1647
+ if (get_oid_mb(options.onto_name, &branch_base) < 0) {
1648
if (keep_base)
1649
die(_("'%s': need exactly one merge base with branch"),
1650
options.upstream_name);
@@ -1652,7 +1652,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1652
die(_("'%s': need exactly one merge base"),
1653
options.onto_name);
1654
}
1655
- options.onto = lookup_commit_or_die(&merge_base,
1655
+ options.onto = lookup_commit_or_die(&branch_base,
1656
options.onto_name);
1657
} else {
1658
options.onto =
@@ -1690,11 +1690,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1690
* in which case we could fast-forward without replacing the commits
1691
* with new commits recreated by replaying their changes.
1692
*
1693
- * Note that can_fast_forward() initializes merge_base, so we have to
1693
+ * Note that can_fast_forward() initializes branch_base, so we have to
1694
* call it before checking allow_preemptive_ff.
1695
*/
1696
if (can_fast_forward(options.onto, options.upstream, options.restrict_revision,
1697
- options.orig_head, &merge_base) &&
1697
+ options.orig_head, &branch_base) &&
1698
allow_preemptive_ff) {
1699
int flag;
1700
@@ -1736,12 +1736,12 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1736
struct diff_options opts;
1737
1738
if (options.flags & REBASE_VERBOSE) {
1739
- if (is_null_oid(&merge_base))
1739
+ if (is_null_oid(&branch_base))
1740
printf(_("Changes to %s:\n"),
1741
oid_to_hex(&options.onto->object.oid));
1742
else
1743
printf(_("Changes from %s to %s:\n"),
1744
- oid_to_hex(&merge_base),
1744
+ oid_to_hex(&branch_base),
1745
oid_to_hex(&options.onto->object.oid));
1746
}
1747
@@ -1753,8 +1753,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1753
DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
1754
opts.detect_rename = DIFF_DETECT_RENAME;
1755
diff_setup_done(&opts);
1756
- diff_tree_oid(is_null_oid(&merge_base) ?
1757
- the_hash_algo->empty_tree : &merge_base,
1756
+ diff_tree_oid(is_null_oid(&branch_base) ?
1757
+ the_hash_algo->empty_tree : &branch_base,
1758
&options.onto->object.oid, "", &opts);
1759
diffcore_std(&opts);
1760
diff_flush(&opts);
@@ -1785,7 +1785,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1785
* we just fast-forwarded.
1786
*/
1787
strbuf_reset(&msg);
1788
- if (oideq(&merge_base, &options.orig_head->object.oid)) {
1788
+ if (oideq(&branch_base, &options.orig_head->object.oid)) {
1789
printf(_("Fast-forwarded %s to %s.\n"),
1790
branch_name, options.onto_name);
1791
strbuf_addf(&msg, "rebase finished: %s onto %s",