From: Eric Sunshine <sunshine@sunshineco.com>
To: Duy Nguyen <pclouds@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, Git List <git@vger.kernel.org>
Subject: Re: [RFC/PATCH] worktree: replace "checkout --to" with "worktree new"
Date: Thu, 2 Jul 2015 14:45:23 -0400 [thread overview]
Message-ID: <CAPig+cR2tn6G0N1sSsrkP_Lo_U_hjLYi08qEsMr+gcsjheaX7A@mail.gmail.com> (raw)
In-Reply-To: <CAPig+cT=U6LxpJuUMaCd-x=gQPvh89SDNUo12+2_3uYb_q3=Og@mail.gmail.com>
On Wed, Jul 1, 2015 at 10:52 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
> However, there are still a few bits of
> code which want to know that the checkout is happening in a new
> worktree. I haven't examined them closely yet to diagnose if this
> specialized knowledge can be eliminated. Perhaps you can weight in. In
> particular:
>
> checkout_paths:
> if (opts->new_worktree)
> die(_("'%s' cannot be used with updating paths"), "--to");
>
> merge_working_tree:
> tree = parse_tree_indirect(old->commit &&
> !opts->new_worktree_mode ?
> old->commit->object.sha1 :
> EMPTY_TREE_SHA1_BIN);
>
> switch_branches:
> if (!opts->quiet && !old.path && old.commit &&
> new->commit != old.commit && !opts->new_worktree_mode)
> orphaned_commit_warning(old.commit, new->commit);
There's another instance: 3473ad0 (checkout: don't require a work tree
when checking out into a new one, 2014-11-30) added this:
if (!new_worktree)
setup_work_tree();
which the "worktree add" patch changed to:
setup_work_tree();
which doesn't hurt (since setup_work_tree() protects itself against
multiple invocations) but isn't semantically clean. If I understand
correctly, I think a better approach would be to move the
setup_work_tree() call to worktree.c just before it invokes
git-checkout, and revert 3473ad0 entirely (including this bit):
- { "checkout", cmd_checkout, RUN_SETUP | NEED_WORK_TREE },
+{ "checkout", cmd_checkout, RUN_SETUP },
so that git-checkout once again requires a worktree.
next prev parent reply other threads:[~2015-07-02 18:45 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-30 4:56 [RFC/PATCH] worktree: replace "checkout --to" with "worktree new" Eric Sunshine
2015-06-30 9:23 ` Duy Nguyen
2015-06-30 16:33 ` Junio C Hamano
2015-07-01 10:46 ` Duy Nguyen
2015-06-30 22:02 ` Eric Sunshine
2015-07-01 6:37 ` Eric Sunshine
2015-06-30 17:13 ` Junio C Hamano
2015-06-30 22:11 ` Eric Sunshine
2015-06-30 22:27 ` Junio C Hamano
2015-07-01 4:48 ` Mikael Magnusson
2015-06-30 22:32 ` Mark Levedahl
2015-07-01 16:53 ` Junio C Hamano
2015-07-01 17:13 ` Eric Sunshine
2015-07-01 17:16 ` Eric Sunshine
2015-07-01 17:32 ` Junio C Hamano
2015-07-01 18:18 ` Eric Sunshine
2015-07-01 18:52 ` Junio C Hamano
2015-07-02 1:07 ` Duy Nguyen
2015-07-02 2:52 ` Eric Sunshine
2015-07-02 12:41 ` Duy Nguyen
2015-07-02 12:50 ` Duy Nguyen
2015-07-02 17:06 ` Eric Sunshine
2015-07-02 22:41 ` Duy Nguyen
2015-07-02 16:59 ` Eric Sunshine
2015-07-02 18:45 ` Eric Sunshine [this message]
2015-07-02 19:00 ` Eric Sunshine
2015-07-02 19:19 ` Eric Sunshine
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPig+cR2tn6G0N1sSsrkP_Lo_U_hjLYi08qEsMr+gcsjheaX7A@mail.gmail.com \
--to=sunshine@sunshineco.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).