branch: improve documentation and naming of create_branch() parameters

The documentation for 'create_branch()' was incomplete as it didn't say what certain parameters were used for. Further a parameter name wasn't very communicative. So, add missing documentation for the sake of completeness and easy reference. Also, rename the concerned parameter to make its name more communicative. 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 f6cea74de63c2926a15b711bec09ed3ab34c2c1e
2 files changed +8 -3
branch.c
+2 -2
@@ -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,
231 + int force, int reflog, int clobber_head_ok,
232 int quiet, enum branch_track track)
233 {
234 struct commit *commit;
@@ -244,7 +244,7 @@ void create_branch(const char *name, const char *start_name,
244
245 if (validate_new_branchname(name, &ref, force,
246 track == BRANCH_TRACK_OVERRIDE ||
247 - clobber_head)) {
247 + clobber_head_ok)) {
248 if (!force)
249 dont_change_ref = 1;
250 else
branch.h
+6 -1
@@ -15,12 +15,17 @@
15 *
16 * - reflog creates a reflog for the branch
17 *
18 + * - clobber_head_ok allows the currently checked out (hence existing)
19 + * branch to be overwritten; without 'force', it has no effect.
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 void create_branch(const char *name, const char *start_name,
27 int force, int reflog,
23 - int clobber_head, int quiet, enum branch_track track);
28 + int clobber_head_ok, int quiet, enum branch_track track);
29
30 /*
31 * Validates that the requested branch may be created, returning the