From: Junio C Hamano Date: Wed, 6 Jul 2016 20:38:11 +0000 (-0700) Subject: Merge branch 'nd/worktree-cleanup-post-head-protection' X-Git-Tag: v2.10.0-rc0~160 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/7a738b40f67fc44c2a2c1abcffe474241af3d30e Merge branch 'nd/worktree-cleanup-post-head-protection' Further preparatory clean-up for "worktree" feature continues. * nd/worktree-cleanup-post-head-protection: worktree: simplify prefixing paths worktree: avoid 0{40}, too many zeroes, hard to read worktree.c: use is_dot_or_dotdot() git-worktree.txt: keep subcommand listing in alphabetical order worktree.c: rewrite mark_current_worktree() to avoid strbuf completion: support git-worktree --- 7a738b40f67fc44c2a2c1abcffe474241af3d30e diff --cc builtin/worktree.c index e3199a22e5,f9dac376f7..e866844685 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@@ -337,12 -337,9 +337,12 @@@ static int add(int ac, const char **av if (ac < 1 || ac > 2) usage_with_options(worktree_usage, options); - path = prefix ? prefix_filename(prefix, strlen(prefix), av[0]) : av[0]; + path = prefix_filename(prefix, strlen(prefix), av[0]); branch = ac < 2 ? "HEAD" : av[1]; + if (!strcmp(branch, "-")) + branch = "@{-1}"; + opts.force_new_branch = !!new_branch_force; if (opts.force_new_branch) { struct strbuf symref = STRBUF_INIT;