diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-03-27 10:59:26 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-27 10:59:26 -0700 |
commit | a026bde1ac84f90f0b82faa18890b2023c5198d5 (patch) | |
tree | 8e976b861d4b23904c09bb1fbdd8004f37cb6e6f /builtin/worktree.c | |
parent | 09fb53568e3e00e30891b118045aa07ede524103 (diff) | |
parent | 3b754eedd58636926d07b14a34799a3aa7b8ebc2 (diff) | |
download | git-a026bde1ac84f90f0b82faa18890b2023c5198d5.tar.gz git-a026bde1ac84f90f0b82faa18890b2023c5198d5.tar.xz |
Merge branch 'jk/prefix-filename'
Code clean-up with minor bugfixes.
* jk/prefix-filename:
bundle: use prefix_filename with bundle path
prefix_filename: simplify windows #ifdef
prefix_filename: return newly allocated string
prefix_filename: drop length parameter
prefix_filename: move docstring to header file
hash-object: fix buffer reuse with --path in a subdirectory
Diffstat (limited to 'builtin/worktree.c')
-rw-r--r-- | builtin/worktree.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin/worktree.c b/builtin/worktree.c index 831fe058a..9993ded41 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -318,7 +318,8 @@ static int add(int ac, const char **av, const char *prefix) { struct add_opts opts; const char *new_branch_force = NULL; - const char *path, *branch; + char *path; + const char *branch; struct option options[] = { OPT__FORCE(&opts.force, N_("checkout <branch> even if already checked out in other worktree")), OPT_STRING('b', NULL, &opts.new_branch, N_("branch"), @@ -338,7 +339,7 @@ static int add(int ac, const char **av, const char *prefix) if (ac < 1 || ac > 2) usage_with_options(worktree_usage, options); - path = prefix_filename(prefix, strlen(prefix), av[0]); + path = prefix_filename(prefix, av[0]); branch = ac < 2 ? "HEAD" : av[1]; if (!strcmp(branch, "-")) |