From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Jonathan Niedier <jrnieder@gmail.com>
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 5/5] unpack-trees: mark new entries skip-worktree appropriately
Date: Sat, 31 Jul 2010 13:14:29 +0700 [thread overview]
Message-ID: <1280556869-707-6-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1280556869-707-1-git-send-email-pclouds@gmail.com>
Sparse checkout narrows worktree down based on the skip-worktree bit
before and after $GIT_DIR/info/sparse-checkout application. If it does
not have that bit before but does after, a narrow is detected and the
file will be removed from worktree.
New files added by merge, however, does not have skip-worktree bit. If
those files appear to be outside checkout area, the same rule applies:
the file gets removed from worktree even though they don't exist in
worktree.
Just pretend they have skip-worktree before in that case, so the rule
is ignored.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
t/t1011-read-tree-sparse-checkout.sh | 2 +-
unpack-trees.c | 2 ++
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh
index 3e01c6e..04d4450 100755
--- a/t/t1011-read-tree-sparse-checkout.sh
+++ b/t/t1011-read-tree-sparse-checkout.sh
@@ -146,7 +146,7 @@ test_expect_success 'read-tree adds to worktree, absent case' '
test ! -f sub/added
'
-test_expect_failure 'read-tree adds to worktree, dirty case' '
+test_expect_success 'read-tree adds to worktree, dirty case' '
echo init.t >.git/info/sparse-checkout &&
git checkout -f removed &&
mkdir sub &&
diff --git a/unpack-trees.c b/unpack-trees.c
index b34ef46..86e6409 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1096,6 +1096,8 @@ static int merged_entry(struct cache_entry *merge, struct cache_entry *old,
if (!old) {
if (verify_absent(merge, "overwritten", o))
return -1;
+ if (!o->skip_sparse_checkout && will_have_skip_worktree(merge, o))
+ update |= CE_SKIP_WORKTREE;
invalidate_ce_path(merge, o);
} else if (!(old->ce_flags & CE_CONFLICTED)) {
/*
--
1.7.1.rc1.69.g24c2f7
next prev parent reply other threads:[~2010-07-31 6:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-31 6:14 [PATCH 0/5] nd/fix-sparse-checkout v2 Nguyễn Thái Ngọc Duy
2010-07-31 6:14 ` [PATCH 1/5] t1011 (sparse checkout): style nitpicks Nguyễn Thái Ngọc Duy
2010-08-02 17:22 ` Junio C Hamano
2010-08-02 17:31 ` Junio C Hamano
2010-07-31 6:14 ` [PATCH 2/5] unpack-trees: only clear CE_UPDATE|CE_REMOVE when skip-worktree is always set Nguyễn Thái Ngọc Duy
2010-08-08 22:39 ` Jonathan Nieder
2010-07-31 6:14 ` [PATCH 3/5] unpack-trees: let read-tree -u remove index entries outside sparse area Nguyễn Thái Ngọc Duy
2010-07-31 6:14 ` [PATCH 4/5] unpack-trees: do not check for conflict entries too early Nguyễn Thái Ngọc Duy
2010-07-31 6:14 ` Nguyễn Thái Ngọc Duy [this message]
2010-08-03 21:16 ` [PATCH 0/5] nd/fix-sparse-checkout v2 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1280556869-707-6-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.