Skip to content

Commit af8d6a9

Browse files
committed
Merge branch 'jk/create-branch-remove-unused-param' into maint
Code clean-up. * jk/create-branch-remove-unused-param: create_branch: drop unused "head" parameter
2 parents 797d1a4 + 4bd488e commit af8d6a9

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

branch.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,7 @@ N_("\n"
228228
"will track its remote counterpart, you may want to use\n"
229229
"\"git push -u\" to set the upstream config as you push.");
230230

231-
void create_branch(const char *head,
232-
const char *name, const char *start_name,
231+
void create_branch(const char *name, const char *start_name,
233232
int force, int reflog, int clobber_head,
234233
int quiet, enum branch_track track)
235234
{

branch.h

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,21 @@
44
/* Functions for acting on the information about branches. */
55

66
/*
7-
* Creates a new branch, where head is the branch currently checked
8-
* out, name is the new branch name, start_name is the name of the
9-
* existing branch that the new branch should start from, force
10-
* enables overwriting an existing (non-head) branch, reflog creates a
11-
* reflog for the branch, and track causes the new branch to be
12-
* configured to merge the remote branch that start_name is a tracking
13-
* branch for (if any).
7+
* Creates a new branch, where:
8+
*
9+
* - name is the new branch name
10+
*
11+
* - start_name is the name of the existing branch that the new branch should
12+
* start from
13+
*
14+
* - force enables overwriting an existing (non-head) branch
15+
*
16+
* - reflog creates a reflog for the branch
17+
*
18+
* - track causes the new branch to be configured to merge the remote branch
19+
* that start_name is a tracking branch for (if any).
1420
*/
15-
void create_branch(const char *head, const char *name, const char *start_name,
21+
void create_branch(const char *name, const char *start_name,
1622
int force, int reflog,
1723
int clobber_head, int quiet, enum branch_track track);
1824

builtin/branch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
807807
* create_branch takes care of setting up the tracking
808808
* info and making sure new_upstream is correct
809809
*/
810-
create_branch(head, branch->name, new_upstream, 0, 0, 0, quiet, BRANCH_TRACK_OVERRIDE);
810+
create_branch(branch->name, new_upstream, 0, 0, 0, quiet, BRANCH_TRACK_OVERRIDE);
811811
} else if (unset_upstream) {
812812
struct branch *branch = branch_get(argv[0]);
813813
struct strbuf buf = STRBUF_INIT;
@@ -853,7 +853,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
853853
strbuf_release(&buf);
854854

855855
branch_existed = ref_exists(branch->refname);
856-
create_branch(head, argv[0], (argc == 2) ? argv[1] : head,
856+
create_branch(argv[0], (argc == 2) ? argv[1] : head,
857857
force, reflog, 0, quiet, track);
858858

859859
/*

builtin/checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
631631
}
632632
}
633633
else
634-
create_branch(old->name, opts->new_branch, new->name,
634+
create_branch(opts->new_branch, new->name,
635635
opts->new_branch_force ? 1 : 0,
636636
opts->new_branch_log,
637637
opts->new_branch_force ? 1 : 0,

0 commit comments

Comments
 (0)