git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: Kevin Willford <kewillf@microsoft.com>
Cc: Kevin Willford <kcwillford@gmail.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>,
	"gitster@pobox.com" <gitster@pobox.com>,
	"peff@peff.net" <peff@peff.net>
Subject: Re: [PATCH 3/3] reset.c: update files when using sparse to avoid data loss.
Date: Mon, 17 Apr 2017 19:09:26 +0700	[thread overview]
Message-ID: <CACsJy8Bb_maecm2ywHuyMXhORXZBMxMzmtdX_YgCq_DVfwy+Dw@mail.gmail.com> (raw)
In-Reply-To: <CACsJy8CbxGPeWHgR8s-ix_wxPODvisw6eaLnEUV4LDmoeXt5BQ@mail.gmail.com>

On Sun, Apr 16, 2017 at 11:25 AM, Duy Nguyen <pclouds@gmail.com> wrote:
>> Because this is a reset --mixed it will never run through unpack_trees and
>> The entries are never marked with CE_REMOVE.
>
> I know. But in my view, it should. All updates from a tree object to
> the index should happen through unpack_trees().

Just fyi. My view is wrong. We need to handle a diff here, not through
unpack_trees() because "git reset --mixed" support partial reset, see
2ce633b928 (git-reset [--mixed] <tree> [--] <paths>... - 2006-12-14).
We might be able to make unpack_trees() leave certain paths(pec)
untouched, but I don't think it is worth it. In other words, your
original patch is the way to go.

PS. I briefly wondered if "git checkout <tree> -- <pathspec>" had the
same problem. I think not, because while --mixed does not touch
worktree, checkout does, so it should restore on-disk versions if
needed. The read_tree_some() call in checkout_paths() should respect
sparse patterns and add skip-worktree bits back if needed though, but
I don't think it does that.
-- 
Duy

  reply	other threads:[~2017-04-17 12:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-07 19:23 [PATCH 0/3] fix working directory file issues while using sparse-checkout Kevin Willford
2017-04-07 19:23 ` [PATCH 1/3] merge-recursive.c: conflict using sparse should update file Kevin Willford
2017-04-10 10:36   ` Duy Nguyen
2017-04-07 19:23 ` [PATCH 2/3] apply.c: do not checkout file when skip-worktree bit set Kevin Willford
2017-04-07 22:28   ` Stefan Beller
2017-04-10 10:11   ` Duy Nguyen
2017-04-07 19:23 ` [PATCH 3/3] reset.c: update files when using sparse to avoid data loss Kevin Willford
2017-04-07 22:41   ` Stefan Beller
2017-04-10 10:24   ` Duy Nguyen
2017-04-11 22:30     ` Kevin Willford
2017-04-12 13:21       ` Duy Nguyen
2017-04-12 15:37         ` Kevin Willford
2017-04-16  4:25           ` Duy Nguyen
2017-04-17 12:09             ` Duy Nguyen [this message]
2017-04-07 19:27 ` [PATCH 0/3] fix working directory file issues while using sparse-checkout Stefan Beller
2017-04-07 19:27   ` 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=CACsJy8Bb_maecm2ywHuyMXhORXZBMxMzmtdX_YgCq_DVfwy+Dw@mail.gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kcwillford@gmail.com \
    --cc=kewillf@microsoft.com \
    --cc=peff@peff.net \
    /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).