branch: group related arguments of create_branch()
39bd6f726 (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 <kaartic.sivaraam@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kaartic Sivaraam committed
Nov 18, 2017 at 22:56 UTC
e2bbd0cc4c1b661cc04620a6704003793b190e7e
4 files changed
+8
-7
branch.c
+1
-1
@@ -228,7 +228,7 @@ N_("\n"
228
"\"git push -u\" to set the upstream config as you push.");
229
230
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,
232
int quiet, enum branch_track track)
233
{
234
struct commit *commit;
branch.h
+5
-4
@@ -13,19 +13,20 @@
13
*
14
* - force enables overwriting an existing (non-head) branch
15
*
16
- * - reflog creates a reflog for the branch
17
- *
16
* - clobber_head_ok allows the currently checked out (hence existing)
17
* branch to be overwritten; without 'force', it has no effect.
18
*
19
+ * - reflog creates a reflog for the branch
20
+ *
21
* - quiet suppresses tracking information
22
*
23
* - track causes the new branch to be configured to merge the remote branch
24
* that start_name is a tracking branch for (if any).
25
+ *
26
*/
27
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);
30
31
/*
32
* Validates that the requested branch may be created, returning the
builtin/branch.c
+1
-1
@@ -806,7 +806,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
806
die(_("the '--set-upstream' option is no longer supported. Please use '--track' or '--set-upstream-to' instead."));
807
808
create_branch(argv[0], (argc == 2) ? argv[1] : head,
809
- force, reflog, 0, quiet, track);
809
+ force, 0, reflog, quiet, track);
810
811
} else
812
usage_with_options(builtin_branch_usage, options);
builtin/checkout.c
+1
-1
@@ -640,8 +640,8 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
640
else
641
create_branch(opts->new_branch, new->name,
642
opts->new_branch_force ? 1 : 0,
643
- opts->new_branch_log,
643
opts->new_branch_force ? 1 : 0,
644
+ opts->new_branch_log,
645
opts->quiet,
646
opts->track);
647
new->name = opts->new_branch;