From: Jay Soffian <jaysoffian@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Nguyen Thai Ngoc Duy <pclouds@gmail.com>, git@vger.kernel.org
Subject: Re: [RFC/PATCH] Add multiple workdir support to branch/checkout
Date: Thu, 6 Oct 2011 00:02:03 -0400 [thread overview]
Message-ID: <CAG+J_DwEx9y-5B+ZppW1jURCYE2f-rkniYnRFjEtd4+spPurQA@mail.gmail.com> (raw)
In-Reply-To: <7v1uuq51c3.fsf@alter.siamese.dyndns.org>
On Wed, Oct 5, 2011 at 9:57 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Jay Soffian <jaysoffian@gmail.com> writes:
>> Now they do what? Either commit --force or create a new branch?
>> Wouldn't it have been better to create the new branch before they
>> started editing?
>
> If they are going to commit, and if they knew that they are going to
> commit, yes.
Committing is obviously the common case for a checked-out branch.
> But why do you want to forbid people from just checking things out if they
> are not interested in committing? That is where I think you are going
> backwards.
Because if they do decide to commit, it's now harder for them to do so.
It would be great if git could intervene after the checkout, but
before they edit any files, so that they don't have uncommitted work.
Obviously that's not possible, so git should prevent them from getting
to that point.
Let's consider the various situations:
1. master is checked out w/edits in workdir1, user wants to work on
topic in workdir2.
There's nothing to warn about in workdir2 neither at checkout nor commit time.
2. master is checked out w/edits in workdir1, user wants examine
unedited master in workdir2
At checkout time in workdir2:
My preference: checkout advices user to use --detach or --force.
Your preference: checkout is silent.
Now user decides they want to commit to master in workdir2 (which is
insane, they've got uncommitted changes to it in workdir1). What
happens?
In my scenario, the commit happens on a detached HEAD. When they
eventually switch back to a branch, git tells them how to move their
commit to a branch.
In your scenario, commit complains. User now has to --force, stash, or
create a new branch.
It's just seems insane to me putting in obstacles to the user
committing their work. That's where I think you are going backwards.
You have a use case where using a detached HEAD doesn't work because
you've scripted around the same branch multiply checked out. I think
that's probably an exceedingly rare use case, and justifies "checkout
--force".
>> I guess it depends what you mostly use your workdirs for. For me, it's
>> to have different branches checked out, not to have the same branch
>> checked out in multiple locations.
>
> Then you wouldn't have any problem if commit refused to make commit on the
> branch that is checked out elsewhere, no?
Yes, I would, because by that point, I've already made the mistake of
checking out the same branch twice. I want git to prevent me from
doing that by accident. Because I don't want to ever be in the
situation which comes next, which is that I've got uncommitted work
for the same branch in two places!
> I am not saying we should never have an option to _warn_ checking out the
> same branch in multiple places. I am saying it is wrong to forbid doing so
> by default.
I am not saying we should never have an option to allow checking out
the same branch in multiple places. I am saying it is wrong to allow
doing so by default.
j.
next prev parent reply other threads:[~2011-10-06 4:02 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-05 3:43 [RFC/PATCH] Add multiple workdir support to branch/checkout Jay Soffian
2011-10-05 3:48 ` Jay Soffian
2011-10-05 4:02 ` Nguyen Thai Ngoc Duy
2011-10-05 13:11 ` Jay Soffian
2011-10-05 16:46 ` Junio C Hamano
2011-10-05 17:17 ` Jay Soffian
2011-10-05 18:19 ` Junio C Hamano
2011-10-05 19:11 ` Jay Soffian
2011-10-05 20:00 ` Andreas Krey
2011-10-05 20:50 ` Jay Soffian
2011-10-05 21:30 ` Jonathan Nieder
2011-10-05 21:52 ` Jay Soffian
2011-10-05 21:57 ` Jonathan Nieder
2011-10-05 21:29 ` Junio C Hamano
2011-10-05 21:49 ` Jay Soffian
2011-10-05 19:14 ` Jay Soffian
2011-10-05 22:47 ` Nguyen Thai Ngoc Duy
2011-10-05 22:56 ` Junio C Hamano
2011-10-05 23:11 ` Nguyen Thai Ngoc Duy
2011-10-05 23:49 ` Junio C Hamano
2011-10-06 0:33 ` Jay Soffian
2011-10-06 0:43 ` Junio C Hamano
2011-10-06 0:57 ` Jay Soffian
2011-10-06 1:15 ` Junio C Hamano
2011-10-06 1:38 ` Jay Soffian
2011-10-06 1:57 ` Junio C Hamano
2011-10-06 4:02 ` Jay Soffian [this message]
2011-10-06 2:06 ` Nguyen Thai Ngoc Duy
2011-10-06 11:25 ` Bernhard R. Link
2011-10-06 14:42 ` Jeff King
2011-10-05 22:38 ` Nguyen Thai Ngoc Duy
2011-10-05 4:07 ` Junio C Hamano
2011-10-05 15:24 ` Jay Soffian
2011-10-05 16:01 ` Jay Soffian
2011-10-08 22:55 ` Julián Landerreche
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAG+J_DwEx9y-5B+ZppW1jURCYE2f-rkniYnRFjEtd4+spPurQA@mail.gmail.com \
--to=jaysoffian@gmail.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.
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 NNTP newsgroup(s).