summaryrefslogtreecommitdiff
path: root/t/t1011-read-tree-sparse-checkout.sh
AgeCommit message (Collapse)AuthorFilesLines
2010-12-22Merge branch 'nd/maint-fix-add-typo-detection'Libravatar Junio C Hamano1-3/+11
* nd/maint-fix-add-typo-detection: Revert "excluded_1(): support exclude files in index" unpack-trees: fix sparse checkout's "unable to match directories" unpack-trees: move all skip-worktree checks back to unpack_trees() dir.c: add free_excludes() cache.h: realign and use (1 << x) form for CE_* constants
2010-11-30unpack-trees: fix sparse checkout's "unable to match directories"Libravatar Nguyễn Thái Ngọc Duy1-3/+11
Matching index entries against an excludes file currently has two problems. First, there's no function to do it. Code paths (like sparse checkout) that wanted to try it would iterate over index entries and for each index entry pass that path to excluded_from_list(). But that is not how excluded_from_list() works; one is supposed to feed in each ancester of a path before a given path to find out if it was excluded because of some parent or grandparent matching a bigsubdirectory/ pattern despite the path not matching any .gitignore pattern directly. Second, it's inefficient. The excludes mechanism is supposed to let us block off vast swaths of the filesystem as uninteresting; separately checking every index entry doesn't fit that model. Introduce a new function to take care of both these problems. This traverses the index in depth-first order (well, that's what order the index is in) to mark un-excluded entries. Maybe some day the in-core index format will be restructured to make this sort of operation easier. Or maybe we will want to try some binary search based thing. The interface is simple enough to allow all those things. Example: clear_ce_flags(the_index.cache, the_index.cache_nr, CE_CANDIDATE, CE_CLEARME, exclude_list); would clear the CE_CLEARME flag on all index entries with CE_CANDIDATE flag and not matched by exclude_list. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-24Merge branch 'en/and-cascade-tests'Libravatar Junio C Hamano1-1/+1
* en/and-cascade-tests: (25 commits) t4124 (apply --whitespace): use test_might_fail t3404: do not use 'describe' to implement test_cmp_rev t3404 (rebase -i): introduce helper to check position of HEAD t3404 (rebase -i): move comment to description t3404 (rebase -i): unroll test_commit loops t3301 (notes): use test_expect_code for clarity t1400 (update-ref): use test_must_fail t1502 (rev-parse --parseopt): test exit code from "-h" t6022 (renaming merge): chain test commands with && test-lib: introduce test_line_count to measure files tests: add missing &&, batch 2 tests: add missing && Introduce sane_unset and use it to ensure proper && chaining t7800 (difftool): add missing && t7601 (merge-pull-config): add missing && t7001 (mv): add missing && t6016 (rev-list-graph-simplify-history): add missing && t5602 (clone-remote-exec): add missing && t4026 (color): remove unneeded and unchained command t4019 (diff-wserror): add lots of missing && ... Conflicts: t/t7006-pager.sh
2010-11-09tests: add missing &&Libravatar Jonathan Nieder1-1/+1
Breaks in a test assertion's && chain can potentially hide failures from earlier commands in the chain. Commands intended to fail should be marked with !, test_must_fail, or test_might_fail. The examples in this patch do not require that. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-08dir.c: fix EXC_FLAG_MUSTBEDIR match in sparse checkoutLibravatar Nguyễn Thái Ngọc Duy1-3/+7
Commit c84de70 (excluded_1(): support exclude files in index - 2009-08-20) tries to work around the fact that there is no directory/file information in index entries, therefore EXC_FLAG_MUSTBEDIR match would fail. Unfortunately the workaround is flawed. This fixes it. Reported-by: Thomas Rinderknecht <thomasr@sailguy.org> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-09unpack-trees: mark new entries skip-worktree appropriatelyLibravatar Nguyễn Thái Ngọc Duy1-1/+1
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>
2010-08-09unpack-trees: let read-tree -u remove index entries outside sparse areaLibravatar Nguyễn Thái Ngọc Duy1-1/+10
To avoid touching the worktree outside a sparse checkout, when the update flag is enabled unpack_trees() clears the CE_UPDATE and CE_REMOVE flags on entries that do not match the sparse pattern before actually committing any updates to the index file or worktree. The effect on the index was unintentional; sparse checkout was never meant to prevent index updates outside the area checked out. And the result is very confusing: for example, after a failed merge, currently "git reset --hard" does not reset the state completely but an additional "git reset --mixed" will. So stop clearing the CE_REMOVE flag. Instead, maintain a CE_WT_REMOVE flag to separately track whether a particular file removal should apply to the worktree in addition to the index or not. The CE_WT_REMOVE flag is used already to mark files that should be removed because of a narrowing checkout area. That usage will still apply; do not clear the CE_WT_REMOVE flag in that case (detectable because the CE_REMOVE flag is not set). This bug masked some other bugs illustrated by the test suite, which will be addressed by later patches. Reported-by: Frédéric Brière <fbriere@fbriere.net> Fixes: http://bugs.debian.org/583699 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>
2010-08-09unpack-trees: only clear CE_UPDATE|CE_REMOVE when skip-worktree is always setLibravatar Nguyễn Thái Ngọc Duy1-0/+12
The purpose of this clearing is, as explained in comment, because verify_*() may set those bits before apply_sparse_checkout() is called. By that time, it's not clear whether an entry will stay in checkout area or out. After $GIT_DIR/info/sparse-checkout is applied, we know what entries will be in finally. It's time to clean unwanted bits. That works perfectly when checkout area remains unchanged. When checkout area changes, apply_sparse_checkout() may set CE_UPDATE or CE_WT_REMOVE to widen/narrow checkout area. Doing the clearing after apply_sparse_checkout() may clear those widening/narrowing bits unexpectedly. So, only do that on entries that are not affected by checkout area changes (i.e. skip-worktree bit does not change after apply_sparse_checkout). This code does not actually fix anything though, just future-proof. The removed code and the narrow/widen code inside apply_sparse_checkout are currently independent (narrow code never sets CE_REMOVE, widen code sets CE_UPDATE, but ce_skip_worktree() would be false). 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>
2010-08-02t1011 (sparse checkout): style nitpicksLibravatar Jonathan Nieder1-47/+55
Tweak the rest of the script to more closely follow the test style guide. Guarding setup commands with test_expect_success makes it easy to see the scope in which some particular data is used; removal of whitespace after >redirection operators is just for consistency. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-25tests: rename duplicate t1009Libravatar Jeff King1-0/+150
We should avoid duplicate test numbers, since things like GIT_SKIP_TESTS consider something like t1009.5 to be unambiguous. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>