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
This commit is contained in:
Junio C Hamano 2016-11-29 13:28:02 -08:00
commit af8d6a9821
4 changed files with 18 additions and 13 deletions

View file

@ -228,8 +228,7 @@ N_("\n"
"will track its remote counterpart, you may want to use\n" "will track its remote counterpart, you may want to use\n"
"\"git push -u\" to set the upstream config as you push."); "\"git push -u\" to set the upstream config as you push.");
void create_branch(const char *head, void create_branch(const char *name, const char *start_name,
const char *name, const char *start_name,
int force, int reflog, int clobber_head, int force, int reflog, int clobber_head,
int quiet, enum branch_track track) int quiet, enum branch_track track)
{ {

View file

@ -4,15 +4,21 @@
/* Functions for acting on the information about branches. */ /* Functions for acting on the information about branches. */
/* /*
* Creates a new branch, where head is the branch currently checked * Creates a new branch, where:
* out, name is the new branch name, start_name is the name of the *
* existing branch that the new branch should start from, force * - name is the new branch name
* enables overwriting an existing (non-head) branch, reflog creates a *
* reflog for the branch, and track causes the new branch to be * - start_name is the name of the existing branch that the new branch should
* configured to merge the remote branch that start_name is a tracking * start from
* branch for (if any). *
* - force enables overwriting an existing (non-head) branch
*
* - reflog creates a reflog for the branch
*
* - track causes the new branch to be configured to merge the remote branch
* that start_name is a tracking branch for (if any).
*/ */
void create_branch(const char *head, const char *name, const char *start_name, void create_branch(const char *name, const char *start_name,
int force, int reflog, int force, int reflog,
int clobber_head, int quiet, enum branch_track track); int clobber_head, int quiet, enum branch_track track);

View file

@ -807,7 +807,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
* create_branch takes care of setting up the tracking * create_branch takes care of setting up the tracking
* info and making sure new_upstream is correct * info and making sure new_upstream is correct
*/ */
create_branch(head, branch->name, new_upstream, 0, 0, 0, quiet, BRANCH_TRACK_OVERRIDE); create_branch(branch->name, new_upstream, 0, 0, 0, quiet, BRANCH_TRACK_OVERRIDE);
} else if (unset_upstream) { } else if (unset_upstream) {
struct branch *branch = branch_get(argv[0]); struct branch *branch = branch_get(argv[0]);
struct strbuf buf = STRBUF_INIT; struct strbuf buf = STRBUF_INIT;
@ -853,7 +853,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
strbuf_release(&buf); strbuf_release(&buf);
branch_existed = ref_exists(branch->refname); branch_existed = ref_exists(branch->refname);
create_branch(head, argv[0], (argc == 2) ? argv[1] : head, create_branch(argv[0], (argc == 2) ? argv[1] : head,
force, reflog, 0, quiet, track); force, reflog, 0, quiet, track);
/* /*

View file

@ -631,7 +631,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
} }
} }
else else
create_branch(old->name, opts->new_branch, new->name, create_branch(opts->new_branch, new->name,
opts->new_branch_force ? 1 : 0, opts->new_branch_force ? 1 : 0,
opts->new_branch_log, opts->new_branch_log,
opts->new_branch_force ? 1 : 0, opts->new_branch_force ? 1 : 0,