Skip to content

Commit

Permalink
sparse: add vfs-specific precautions
Browse files Browse the repository at this point in the history
* t1092: remove the 'git update-index' test that currently fails
  because the command ignores the bad path, but doesn't return a
  failure.

* dir.c: prevent matching against sparse-checkout patterns when the
  virtual filesystem is enabled. Should prevent some corner case
  issues.

* t1092: add quiet mode for some rebase tests because the stderr
  output can change in some of the modes.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
  • Loading branch information
derrickstolee authored and dscho committed Nov 3, 2023
1 parent 84314b0 commit c4390e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1533,6 +1533,13 @@ static int path_in_sparse_checkout_1(const char *path,
enum pattern_match_result match = UNDECIDED;
const char *end, *slash;

/*
* When using a virtual filesystem, there aren't really patterns
* to follow, but be extra careful to skip this check.
*/
if (core_virtualfilesystem)
return 1;

/*
* We default to accepting a path if the path is empty, there are no
* patterns, or the patterns are of the wrong type.
Expand Down
4 changes: 3 additions & 1 deletion t/t1092-sparse-checkout-compatibility.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,9 @@ test_expect_success 'read-tree --merge with directory-file conflicts' '
test_expect_success 'merge, cherry-pick, and rebase' '
init_repos &&
for OPERATION in "merge -m merge" cherry-pick "rebase --apply" "rebase --merge"
# microsoft/git specific: we need to use "quiet" mode
# to avoid different stderr for some rebases.
for OPERATION in "merge -m merge" cherry-pick "rebase -q --apply" "rebase -q --merge"
do
test_all_match git checkout -B temp update-deep &&
test_all_match git $OPERATION update-folder1 &&
Expand Down

0 comments on commit c4390e2

Please sign in to comment.