git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 0/2] refs: a couple of --exclude fixes

From
Taylor Blau <me@ttaylorr.com>
Date
Mar 6, 2025, 15:34 UTC
Message-ID
<cover.1741275245.git.me@ttaylorr.com>
In-Reply-To
<cover.1741223981.git.me@ttaylorr.com>

Here is a small reroll of my series to fix a couple of quirks with the --exclude pattern matching.

The changes since last time are fairly minor: the second patch's subject line was reworded (thanks to a suggestion by Patrick). Likewise, its test script changed slightly to reflect that "refs/heads/ba" and "refs/heads/bar" are no longer considered overlapping regions.

For convenience, a range-diff is below. Thanks again for your review :-).

Taylor Blau (2):
  refs.c: remove empty '--exclude' patterns
  refs.c: stop matching non-directory prefixes in exclude patterns
 refs.c                  | 20 ++++++++++++++++++++
 t/t1419-exclude-refs.sh | 26 ++++++++++++++++++++++++--
 2 files changed, 44 insertions(+), 2 deletions(-)
Range-diff against v1:
1:  c3b5ca5973 = 1:  c3b5ca5973 refs.c: remove empty '--exclude' patterns
2:  7e6a5e020b ! 2:  67c8c5f797 refs.c: unify '--exclude' behavior between files and packed backends
    @@ Metadata
     Author: Taylor Blau <me@ttaylorr.com>
      ## Commit message ##
    -    refs.c: unify '--exclude' behavior between files and packed backends
    +    refs.c: stop matching non-directory prefixes in exclude patterns
         In the packed-refs backend, our implementation of '--exclude' (dating
         back to 59c35fac54 (refs/packed-backend.c: implement jump lists to avoid
    @@ Commit message
         But that test fallout is expected, because the test was codifying the
         buggy behavior to begin with, and should have never been written that
    -    way.
    +    way. Split that into its own test (since the range is no longer
    +    overlapping under the stricter interpretation of --exclude patterns
    +    presented here). Create a new test which does have overlapping
    +    regions by using a refs/heads/bar/4/... hierarchy and excluding both
    +    "refs/heads/bar" and "refs/heads/bar/4".
         Reported-by: SURA <surak8806@gmail.com>
         Helped-by: Jeff King <peff@peff.net>
    @@ refs.c: struct ref_iterator *refs_ref_iterator_begin(
      		exclude_patterns = normalized_exclude_patterns.v;
      ## t/t1419-exclude-refs.sh ##
    +@@ t/t1419-exclude-refs.sh: test_expect_success 'setup' '
    + 			echo "create refs/heads/$name/$i $base" || return 1
    + 		done || return 1
    + 	done >in &&
    ++	for i in 5 6 7
    ++	do
    ++		echo "create refs/heads/bar/4/$i $base" || return 1
    ++	done >>in &&
    + 	echo "delete refs/heads/main" >>in &&
    +
    + 	git update-ref --stdin <in &&
     @@ t/t1419-exclude-refs.sh: test_expect_success 'adjacent, non-overlapping excluded regions' '
    + 	esac
    + '
    - test_expect_success 'overlapping excluded regions' '
    +-test_expect_success 'overlapping excluded regions' '
    ++test_expect_success 'non-directory excluded regions' '
      	for_each_ref__exclude refs/heads refs/heads/ba refs/heads/baz >actual 2>perf &&
     -	for_each_ref refs/heads/foo refs/heads/quux >expect &&
     +	for_each_ref refs/heads/bar refs/heads/foo refs/heads/quux >expect &&
    ++
    ++	test_cmp expect actual &&
    ++	assert_jumps 1 perf
    ++'
    ++
    ++test_expect_success 'overlapping excluded regions' '
    ++	for_each_ref__exclude refs/heads refs/heads/bar refs/heads/bar/4 >actual 2>perf &&
    ++	for_each_ref refs/heads/baz refs/heads/foo refs/heads/quux >expect &&
      	test_cmp expect actual &&
      	assert_jumps 1 perf

base-commit: 6a64ac7b014fa2cfa7a69af3c253bcd53a94b428 -- 2.49.0.rc1.2.g67c8c5f7978

Previous: Taylor BlauNext: Taylor Blau
Message 6 of 17 in “refs: a couple of --exclude fixes”
  1. 0/2 refs: a couple of --exclude fixesTaylor Blau, Mar 6, 2025
  2. 1/2 refs.c: remove empty '--exclude' patternsTaylor Blau, Mar 6, 2025
  3. 2/2 refs.c: unify '--exclude' behavior between files and packed backendsTaylor Blau, Mar 6, 2025
  4. Patrick SteinhardtMar 6, 2025
  5. Taylor BlauMar 6, 2025
  6. 0/2 refs: a couple of --exclude fixesTaylor Blau, Mar 6, 2025
  7. 1/2 refs.c: remove empty '--exclude' patternsTaylor Blau, Mar 6, 2025
  8. Elijah NewrenMar 7, 2025
  9. Taylor BlauMar 7, 2025
  10. Elijah NewrenMar 7, 2025
  11. 2/2 refs.c: stop matching non-directory prefixes in exclude patternsTaylor Blau, Mar 6, 2025
  12. Junio C HamanoMar 6, 2025
  13. Patrick SteinhardtMar 7, 2025
  14. Junio C HamanoMar 7, 2025
  15. Taylor BlauMar 7, 2025
  16. Elijah NewrenMar 7, 2025
  17. Taylor BlauMar 7, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.