]> git.ipfire.org Git - thirdparty/git.git/commitdiff
create_branch: drop unused "head" parameter
authorJeff King <peff@peff.net>
Fri, 4 Nov 2016 16:30:12 +0000 (12:30 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 9 Nov 2016 22:56:21 +0000 (14:56 -0800)
This function used to have the caller pass in the current
value of HEAD, in order to make sure we didn't clobber HEAD.
In 55c4a6730, that logic moved to validate_new_branchname(),
which just resolves HEAD itself. The parameter to
create_branch is now unused.

Since we have to update and re-wrap the docstring describing
the parameters anyway, let's take this opportunity to break
it out into a list, which makes it easier to find the
parameters.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
branch.c
branch.h
builtin/branch.c
builtin/checkout.c

index a5a8dcbd0ed929d09a73674361ee1dd81dd5b88c..0d459b3cfe507b3906760fbea7f35e6191366057 100644 (file)
--- a/branch.c
+++ b/branch.c
@@ -228,8 +228,7 @@ N_("\n"
 "will track its remote counterpart, you may want to use\n"
 "\"git push -u\" to set the upstream config as you push.");
 
-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 clobber_head,
                   int quiet, enum branch_track track)
 {
index b2f964933270e1306eff1f0589c58efd22d6c76b..3103eb9add31e08600f9fa158303417e36d3b229 100644 (file)
--- a/branch.h
+++ b/branch.h
@@ -4,15 +4,21 @@
 /* Functions for acting on the information about branches. */
 
 /*
- * Creates a new branch, where head is the branch currently checked
- * out, name is the new branch name, start_name is the name of the
- * existing branch that the new branch should start from, force
- * enables overwriting an existing (non-head) branch, reflog creates a
- * reflog for the branch, and track causes the new branch to be
- * configured to merge the remote branch that start_name is a tracking
- * branch for (if any).
+ * Creates a new branch, where:
+ *
+ *   - name is the new branch name
+ *
+ *   - start_name is the name of the existing branch that the new branch should
+ *     start from
+ *
+ *   - 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 clobber_head, int quiet, enum branch_track track);
 
index 2ecde53bf838777e191926557c0c8190cdc7d09a..6c3b570cf7a68839793d4a15b856fe4b65263e57 100644 (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
                 * 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) {
                struct branch *branch = branch_get(argv[0]);
                struct strbuf buf = STRBUF_INIT;
@@ -853,7 +853,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
                strbuf_release(&buf);
 
                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);
 
                /*
index d3b296880e7643cdc34b8f8aed4a377ea28d14fc..d561f7491d55c0b49224fa6c47222fb901bf18fe 100644 (file)
@@ -628,7 +628,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
                        }
                }
                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_log,
                                      opts->new_branch_force ? 1 : 0,