git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: "Jeff King" <peff@peff.net>, "René Scharfe" <l.s.r@web.de>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCHv2 4/5] unpack-trees: factor file removal out of check_updates
Date: Tue, 10 Jan 2017 13:34:43 -0800	[thread overview]
Message-ID: <xmqq37gqr43w.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <CAGZ79kbXVCvZuj6rTckGwOfFtRSFpx9p611oKfFLAayTgB242Q@mail.gmail.com> (Stefan Beller's message of "Tue, 10 Jan 2017 12:51:03 -0800")

Stefan Beller <sbeller@google.com> writes:

> As far as I understand the operations now, a working tree operation
> is done like this:
>
> * First compute the new index, how the world would look like
>   (don't touch a thing in the working tree, it is like a complete
>   dry run, that just checks for potential loss of data, e.g.
>   untracked files, merge conflicts etc)
> * remove all files to be marked for deletion
> * add and update all files that are new or change content.
>
> check_updates does the last two things listed here, which in the
> grand scheme of things looked odd to me.

In the grand scheme of things, the flow has always been understood
more like this two-step process:

    - compute the result in core (rejecting an inconsistent result
      before touching the working tree)

    - reflect the result to the working tree

and the latter is done by check_updates().  

Removing gone entries before instanciating possibly new entries is
done in order to make room where we can create a new path D/F in the
result, after removing an old path D [*1*].  But it is merely an
implementation detail of the latter, i.e. "reflect the result to the
working tree.

It is arguably true that check_updates() is not about "checking" but
is about "doing", hence is misnamed.

[Footnote]

*1* If the result computed in-core wants to create D/F, it must have
removal of D---otherwise the result is inconsistent.

  reply	other threads:[~2017-01-10 21:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-09 19:46 [PATCHv2 0/5] refactor unpack-trees Stefan Beller
2017-01-09 19:46 ` [PATCHv2 1/5] unpack-trees: move checkout state into check_updates Stefan Beller
2017-01-09 19:46 ` [PATCHv2 2/5] unpack-trees: remove unneeded continue Stefan Beller
2017-01-10 19:55   ` Junio C Hamano
2017-01-09 19:46 ` [PATCHv2 3/5] unpack-trees: factor progress setup out of check_updates Stefan Beller
2017-01-09 19:46 ` [PATCHv2 4/5] unpack-trees: factor file removal " Stefan Beller
2017-01-10 20:05   ` Junio C Hamano
2017-01-10 20:51     ` Stefan Beller
2017-01-10 21:34       ` Junio C Hamano [this message]
2017-01-09 19:46 ` [PATCHv2 5/5] unpack-trees: factor working tree update " Stefan Beller

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=xmqq37gqr43w.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    --cc=peff@peff.net \
    --cc=sbeller@google.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).