summaryrefslogtreecommitdiff
path: root/unpack-trees.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-07-31 13:14:29 +0700
committerJunio C Hamano <gitster@pobox.com>2010-08-09 12:16:02 -0700
commit74da98f9c761b2e63366a643fa52749844ddc6a1 (patch)
tree41d872160ae1685c296973a6825a4636bb3b90c3 /unpack-trees.c
parent711f151a7b56f450e3a17b734e84f71bb57522c6 (diff)
downloadgit-74da98f9c761b2e63366a643fa52749844ddc6a1.tar.gz
unpack-trees: mark new entries skip-worktree appropriately
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> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index 7c9b0466c9..8b16215322 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)) {
/*