void create_branch(struct repository *r,
const char *name, const char *start_name,
int force, int clobber_head_ok, int reflog,
- int quiet, enum branch_track track)
+ int quiet, enum branch_track track, int dry_run)
{
struct object_id oid;
char *real_ref;
}
dwim_branch_start(r, start_name, track, &real_ref, &oid);
+ if (dry_run)
+ goto cleanup;
if (reflog)
log_all_ref_updates = LOG_REFS_NORMAL;
if (real_ref && track)
setup_tracking(ref.buf + 11, real_ref, track, quiet);
+cleanup:
strbuf_release(&ref);
free(real_ref);
}
* - track causes the new branch to be configured to merge the remote branch
* that start_name is a tracking branch for (if any).
*
+ * - dry_run causes the branch to be validated but not created.
+ *
*/
void create_branch(struct repository *r,
const char *name, const char *start_name,
int force, int clobber_head_ok,
- int reflog, int quiet, enum branch_track track);
+ int reflog, int quiet, enum branch_track track,
+ int dry_run);
/*
* Check if 'name' can be a valid name for a branch; die otherwise.
create_branch(the_repository,
argv[0], (argc == 2) ? argv[1] : head,
- force, 0, reflog, quiet, track);
+ force, 0, reflog, quiet, track, 0);
} else
usage_with_options(builtin_branch_usage, options);
opts->new_branch_force ? 1 : 0,
opts->new_branch_log,
opts->quiet,
- opts->track);
+ opts->track,
+ 0);
new_branch_info->name = opts->new_branch;
setup_branch_path(new_branch_info);
}