Skip to content

Commit e2bbd0c

Browse files
sivaraamgitster
authored andcommitted
branch: group related arguments of create_branch()
39bd6f7 (Allow checkout -B <current-branch> to update the current branch, 2011-11-26) added 'clobber_head' (now, 'clobber_head_ok') "before" 'track' as 'track' was closely related 'clobber_head' for the purpose the commit wanted to achieve. Looking from the perspective of how the arguments are used it turns out that 'clobber_head' is more related to 'force' than it is to 'track'. So, re-order the arguments to keep the related arguments close to each other. Signed-off-by: Kaartic Sivaraam <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f6cea74 commit e2bbd0c

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

branch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ N_("\n"
228228
"\"git push -u\" to set the upstream config as you push.");
229229

230230
void create_branch(const char *name, const char *start_name,
231-
int force, int reflog, int clobber_head_ok,
231+
int force, int clobber_head_ok, int reflog,
232232
int quiet, enum branch_track track)
233233
{
234234
struct commit *commit;

branch.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,20 @@
1313
*
1414
* - force enables overwriting an existing (non-head) branch
1515
*
16-
* - reflog creates a reflog for the branch
17-
*
1816
* - clobber_head_ok allows the currently checked out (hence existing)
1917
* branch to be overwritten; without 'force', it has no effect.
2018
*
19+
* - reflog creates a reflog for the branch
20+
*
2121
* - quiet suppresses tracking information
2222
*
2323
* - track causes the new branch to be configured to merge the remote branch
2424
* that start_name is a tracking branch for (if any).
25+
*
2526
*/
2627
void create_branch(const char *name, const char *start_name,
27-
int force, int reflog,
28-
int clobber_head_ok, int quiet, enum branch_track track);
28+
int force, int clobber_head_ok,
29+
int reflog, int quiet, enum branch_track track);
2930

3031
/*
3132
* Validates that the requested branch may be created, returning the

builtin/branch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
806806
die(_("the '--set-upstream' option is no longer supported. Please use '--track' or '--set-upstream-to' instead."));
807807

808808
create_branch(argv[0], (argc == 2) ? argv[1] : head,
809-
force, reflog, 0, quiet, track);
809+
force, 0, reflog, quiet, track);
810810

811811
} else
812812
usage_with_options(builtin_branch_usage, options);

builtin/checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,8 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
640640
else
641641
create_branch(opts->new_branch, new->name,
642642
opts->new_branch_force ? 1 : 0,
643-
opts->new_branch_log,
644643
opts->new_branch_force ? 1 : 0,
644+
opts->new_branch_log,
645645
opts->quiet,
646646
opts->track);
647647
new->name = opts->new_branch;

0 commit comments

Comments
 (0)