From: Stefan Beller <sbeller@google.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Nevada Sanchez <sanchez.nevada@gmail.com>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Bug with .gitignore and branch switching
Date: Fri, 17 Mar 2017 14:58:48 -0700 [thread overview]
Message-ID: <CAGZ79kZQsauBfoTjyqm+-+LjyyEc2Ykj5exUY5KdErEzFH0GMA@mail.gmail.com> (raw)
In-Reply-To: <xmqqmvcj61j2.fsf@gitster.mtv.corp.google.com>
On Fri, Mar 17, 2017 at 2:23 PM, Junio C Hamano <gitster@pobox.com> wrote:
> We've discussed the lack of "untracked but precious" class a few
> times on the list in the past, but I do not recall the topic came up
> in the recent past. It perhaps is because nobody found that class
> useful enough so far.
My gut reaction on reading the bug report was that the root cause is
git-checkout doing the wrong thing by default. (cf. Git-Merge-2017,
"What’s Wrong With Git?", I am not sure if the video is yet available)
One argument in that talk was that Git promises to do "work on multiple
branches in parallel (context-switched, single threaded)", and git-checkout
is the apparent command to switch to another context (branch).
However by putting away only tracked content, we miss
doing a proper context switch for untracked and ignored files.
That partial switch has advantages in the typical use case, e.g.
* compiled objects in the worktree may not need to be recompiled.
* no need to do work for the untracked files (e.g. move to a special
location).
Both these reasons argue for performance, instead of "correctness"
in the sense of "easy-to-understand commands for top level principles".
And in that talk the presenter concluded that git-stash was only invented
to circumvent these "correctness" problems, such that if git-checkout
were to also (de)populate the untracked and ignored files on branch
switch we would not need git-stash, because git-checkout did it for you
already. And by the omission of git-stash and an apparent
easier-to-understand git-checkout the whole git suite would become
easier for users.
I further conclude that when git-checkout were to behave "correct" as
outlined above, then this class of bug reports would not occur.
Just food for thought.
Thanks,
Stefan
next prev parent reply other threads:[~2017-03-17 22:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-17 20:42 Bug with .gitignore and branch switching Nevada Sanchez
2017-03-17 21:23 ` Junio C Hamano
2017-03-17 21:58 ` Stefan Beller [this message]
2017-03-17 22:02 ` Jonathan Nieder
2017-03-17 22:36 ` Junio C Hamano
2017-03-18 3:40 ` Duy Nguyen
2017-03-18 4:30 ` Nevada Sanchez
2017-03-17 21:54 ` Jonathan Nieder
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=CAGZ79kZQsauBfoTjyqm+-+LjyyEc2Ykj5exUY5KdErEzFH0GMA@mail.gmail.com \
--to=sbeller@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=sanchez.nevada@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).