summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Gummerer <t.gummerer@gmail.com>2018-03-25 14:49:44 +0100
committerJunio C Hamano <gitster@pobox.com>2018-03-27 15:38:26 -0700
commitf24f163e8f915662e4208232f1f12a6537aeeea6 (patch)
tree725ed414f5e35f08c083c5e2e9df1d31c984851f
parent9b6f1a5a4cfb3567941aec0c7bd88a6c4d9cc4c5 (diff)
downloadgit-f24f163e8f915662e4208232f1f12a6537aeeea6.tar.gz
worktree: remove force_new_branch from struct add_opts
The 'force_new_branch' flag in 'struct add_opts' is only used inside the add function, where we already have the same information stored in the 'new_branch_force' variable. Avoid that unnecessary duplication. Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/worktree.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/builtin/worktree.c b/builtin/worktree.c
index a082230b6c..1e4a919a00 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -28,7 +28,6 @@ struct add_opts {
int checkout;
int keep_locked;
const char *new_branch;
- int force_new_branch;
};
static int show_only;
@@ -405,8 +404,7 @@ static int add(int ac, const char **av, const char *prefix)
if (!strcmp(branch, "-"))
branch = "@{-1}";
- opts.force_new_branch = !!new_branch_force;
- if (opts.force_new_branch) {
+ if (new_branch_force) {
struct strbuf symref = STRBUF_INIT;
opts.new_branch = new_branch_force;
@@ -450,7 +448,7 @@ static int add(int ac, const char **av, const char *prefix)
struct child_process cp = CHILD_PROCESS_INIT;
cp.git_cmd = 1;
argv_array_push(&cp.args, "branch");
- if (opts.force_new_branch)
+ if (new_branch_force)
argv_array_push(&cp.args, "--force");
argv_array_push(&cp.args, opts.new_branch);
argv_array_push(&cp.args, branch);