Skip to content

Commit a770602

Browse files
phillipwoodgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f21becd commit a770602

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

builtin/rebase.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -860,22 +860,22 @@ static int is_linear_history(struct commit *from, struct commit *to)
860860

861861
static int can_fast_forward(struct commit *onto, struct commit *upstream,
862862
struct commit *restrict_revision,
863-
struct commit *head, struct object_id *merge_base)
863+
struct commit *head, struct object_id *branch_base)
864864
{
865865
struct commit_list *merge_bases = NULL;
866866
int res = 0;
867867

868868
merge_bases = get_merge_bases(onto, head);
869869
if (!merge_bases || merge_bases->next) {
870-
oidcpy(merge_base, null_oid());
870+
oidcpy(branch_base, null_oid());
871871
goto done;
872872
}
873873

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))
876876
goto done;
877877

878-
if (restrict_revision && !oideq(&restrict_revision->object.oid, merge_base))
878+
if (restrict_revision && !oideq(&restrict_revision->object.oid, branch_base))
879879
goto done;
880880

881881
if (!upstream)
@@ -1029,7 +1029,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
10291029
struct strbuf msg = STRBUF_INIT;
10301030
struct strbuf revisions = STRBUF_INIT;
10311031
struct strbuf buf = STRBUF_INIT;
1032-
struct object_id merge_base;
1032+
struct object_id branch_base;
10331033
int ignore_whitespace = 0;
10341034
enum action action = ACTION_NONE;
10351035
const char *gpg_sign = NULL;
@@ -1644,15 +1644,15 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
16441644
} else if (!options.onto_name)
16451645
options.onto_name = options.upstream_name;
16461646
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) {
16481648
if (keep_base)
16491649
die(_("'%s': need exactly one merge base with branch"),
16501650
options.upstream_name);
16511651
else
16521652
die(_("'%s': need exactly one merge base"),
16531653
options.onto_name);
16541654
}
1655-
options.onto = lookup_commit_or_die(&merge_base,
1655+
options.onto = lookup_commit_or_die(&branch_base,
16561656
options.onto_name);
16571657
} else {
16581658
options.onto =
@@ -1690,11 +1690,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
16901690
* in which case we could fast-forward without replacing the commits
16911691
* with new commits recreated by replaying their changes.
16921692
*
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
16941694
* call it before checking allow_preemptive_ff.
16951695
*/
16961696
if (can_fast_forward(options.onto, options.upstream, options.restrict_revision,
1697-
options.orig_head, &merge_base) &&
1697+
options.orig_head, &branch_base) &&
16981698
allow_preemptive_ff) {
16991699
int flag;
17001700

@@ -1736,12 +1736,12 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
17361736
struct diff_options opts;
17371737

17381738
if (options.flags & REBASE_VERBOSE) {
1739-
if (is_null_oid(&merge_base))
1739+
if (is_null_oid(&branch_base))
17401740
printf(_("Changes to %s:\n"),
17411741
oid_to_hex(&options.onto->object.oid));
17421742
else
17431743
printf(_("Changes from %s to %s:\n"),
1744-
oid_to_hex(&merge_base),
1744+
oid_to_hex(&branch_base),
17451745
oid_to_hex(&options.onto->object.oid));
17461746
}
17471747

@@ -1753,8 +1753,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
17531753
DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
17541754
opts.detect_rename = DIFF_DETECT_RENAME;
17551755
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,
17581758
&options.onto->object.oid, "", &opts);
17591759
diffcore_std(&opts);
17601760
diff_flush(&opts);
@@ -1785,7 +1785,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
17851785
* we just fast-forwarded.
17861786
*/
17871787
strbuf_reset(&msg);
1788-
if (oideq(&merge_base, &options.orig_head->object.oid)) {
1788+
if (oideq(&branch_base, &options.orig_head->object.oid)) {
17891789
printf(_("Fast-forwarded %s to %s.\n"),
17901790
branch_name, options.onto_name);
17911791
strbuf_addf(&msg, "rebase finished: %s onto %s",

0 commit comments

Comments
 (0)