From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 3/3] Mark new entries skip-worktree appropriately
Date: Mon, 26 Jul 2010 16:08:30 +0700 [thread overview]
Message-ID: <1280135310-2347-3-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1280135310-2347-1-git-send-email-pclouds@gmail.com>
Sparse checkout updates worktree based on the old and new
skip-worktree status when $GIT_DIR/info/sparse-checkout changes:
old = ce_skip_worktree(ce); // current skip-worktree
new = will_have_skip_work_tree(ce); // from $GIT..sparse-checkout
if (old && !new) add_file_back(ce); // shrink checkout area
if (!old && new) remove_file_out(ce); [1] // enlarge checkout area
New entries after merging will always have skip-worktree unset
(i.e. old = 0). If those files are filtered out by
$GIT_DIR/info/sparse-checkout (i.e. new != 0), then case [1] will
happen. But there is nothing to remove because they're new.
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 885578a..86a6246 100755
--- a/t/t1011-read-tree-sparse-checkout.sh
+++ b/t/t1011-read-tree-sparse-checkout.sh
@@ -138,7 +138,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 7ea8c5f..f98b1cb 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1091,6 +1091,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-26 9:53 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-26 9:08 [PATCH 1/3] Fix sparse checkout not removing files from index Nguyễn Thái Ngọc Duy
2010-07-26 9:08 ` [PATCH 2/3] unpack-trees.c: Do not check ce_stage in will_have_skip_worktree() Nguyễn Thái Ngọc Duy
2010-07-31 2:11 ` Jonathan Nieder
2010-07-31 3:12 ` Nguyen Thai Ngoc Duy
2010-07-26 9:08 ` Nguyễn Thái Ngọc Duy [this message]
2010-07-31 2:32 ` [PATCH 3/3] Mark new entries skip-worktree appropriately Jonathan Nieder
2010-07-31 3:13 ` Nguyen Thai Ngoc Duy
2010-07-31 3:29 ` Jonathan Nieder
2010-07-30 1:35 ` [PATCH 1/3] Fix sparse checkout not removing files from index Jonathan Nieder
2010-07-30 8:24 ` Nguyen Thai Ngoc Duy
2010-07-30 19:50 ` Jonathan Nieder
2010-07-31 1:04 ` Jonathan Nieder
2010-07-31 1:05 ` [PATCH 1/2] t1011 (sparse checkout): style nitpicks Jonathan Nieder
2010-07-31 1:09 ` [PATCH 2/2] read-tree -m -u: always remove relevant files when narrowing checkout Jonathan Nieder
2010-07-31 3:28 ` [PATCH 1/3] Fix sparse checkout not removing files from index Nguyen Thai Ngoc Duy
2010-07-31 3:33 ` Jonathan Nieder
2010-07-31 3:48 ` Nguyen Thai Ngoc Duy
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=1280135310-2347-3-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).