Skip to content

pr-1069/derrickstolee/sparse-checkout/input-bug-v4

This series fixes some issues with parsing sparse-checkout patterns when
core.sparseCheckoutCone is enabled but the sparse-checkout file itself
contains patterns that don't match the cone mode format.

The first patch fixes a segfault first reported in [1]. The other two
patches are from an earlier submission [2] that never got picked up and I
lost track of. There was another patch involving 'git sparse-checkout init
--cone' that isn't necessary, especially with Elijah doing some work in that
space right now.

[1] https://github.com/git-for-windows/git/issues/3498 [2]
https://lore.kernel.org/git/pull.1043.git.1632160658.gitgitgadget@gmail.com

Thanks, -Stolee

Update in v4
============

 * For added precaution, this kind of unexpected duplicate pattern will
   disable cone mode matching.
 * Tests are updated to verify this new behavior.

Updates in v2 and v3
====================

 * I intended to fix a typo in a patch, but accidentally sent the amend!
   commit in v2
 * v3 has the typo fix properly squashed in.
 * Added Elijah's review.

Derrick Stolee (3):
  sparse-checkout: fix segfault on malformed patterns
  sparse-checkout: fix OOM error with mixed patterns
  sparse-checkout: refuse to add to bad patterns

 builtin/sparse-checkout.c          |  5 +++-
 dir.c                              |  6 ++---
 t/t1091-sparse-checkout-builtin.sh | 37 +++++++++++++++++++++++++++++-
 3 files changed, 42 insertions(+), 6 deletions(-)

base-commit: abe6bb3905392d5eb6b01fa6e54d7e784e0522aa

Submitted-As: https://lore.kernel.org/git/pull.1069.v4.git.1639671222.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.1069.git.1638907336.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.1069.v2.git.1639149490.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.1069.v3.git.1639575968.gitgitgadget@gmail.com
Assets 2