diff options
author | Derrick Stolee <dstolee@microsoft.com> | 2019-11-21 22:04:45 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-11-22 16:11:44 +0900 |
commit | e9de487aa36aa75b5c9068c6bd07cfb8bf2ee955 (patch) | |
tree | 7547885c82f1eb655d8cf51a33e57beea1e63464 /builtin/verify-pack.c | |
parent | unpack-trees: add progress to clear_ce_flags() (diff) | |
download | tgif-e9de487aa36aa75b5c9068c6bd07cfb8bf2ee955.tar.xz |
sparse-checkout: sanitize for nested folders
If a user provides folders A/ and A/B/ for inclusion in a cone-mode
sparse-checkout file, the parsing logic will notice that A/ appears
both as a "parent" type pattern and as a "recursive" type pattern.
This is unexpected and hence will complain via a warning and revert
to the old logic for checking sparse-checkout patterns.
Prevent this from happening accidentally by sanitizing the folders
for this type of inclusion in the 'git sparse-checkout' builtin.
This happens in two ways:
1. Do not include any parent patterns that also appear as recursive
patterns.
2. Do not include any recursive patterns deeper than other recursive
patterns.
In order to minimize duplicate code for scanning parents, create
hashmap_contains_parent() method. It takes a strbuf buffer to
avoid reallocating a buffer when calling in a tight loop.
Helped-by: Eric Wong <e@80x24.org>
Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/verify-pack.c')
0 files changed, 0 insertions, 0 deletions