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

Re: [PATCHv8 5/5] pathspec: allow querying for attributes

From
Junio C Hamano <gitster@pobox.com>
Date
May 19, 2016, 19:37 UTC
Message-ID
<xmqqa8jlj0tn.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20160519010935.27856-6-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
Show 9 quoted lines
> +test_expect_success 'setup a tree' '
> +	mkdir sub &&
> +	for p in fileA fileB fileC fileAB fileAC fileBC fileNoLabel fileUnsetLabel fileSetLabel fileValue fileWrongLabel; do
> +		: >$p &&
> +		git add $p &&
> +		: >sub/$p
> +		git add sub/$p
> +	done &&
> +	git commit -m $p &&
What does this $p refer to?
Show 27 quoted lines
> +	git ls-files >actual &&
> +	cat <<EOF >expect &&
> +fileA
> +fileAB
> +fileAC
> +fileB
> +fileBC
> +fileC
> +fileNoLabel
> +fileSetLabel
> +fileUnsetLabel
> +fileValue
> +fileWrongLabel
> +sub/fileA
> +sub/fileAB
> +sub/fileAC
> +sub/fileB
> +sub/fileBC
> +sub/fileC
> +sub/fileNoLabel
> +sub/fileSetLabel
> +sub/fileUnsetLabel
> +sub/fileValue
> +sub/fileWrongLabel
> +EOF
> +	test_cmp expect actual
> +'

If I were doing this, I'd prepare the list of paths (i.e. expect) first and then create these paths using that list, i.e.

test_expect_success 'setup a tree' '
	cat <<-\EOF >expect &&
	fileA
	fileAB
	...
	sub/fileWrongLabel
	EOF
	mkdir sub &&
	while read path
	do
		: >$path &&
		git add $path || return 1
	done <expect &&
	git commit -m initial &&
	git ls-files >actual &&
	test_cmp expect actual
'
Previous: Junio C HamanoNext: Junio C Hamano
Message 12 of 22 in “[PATCHv8 0/5] pathspec magic extension to search for attributes”
  1. Stefan BellerMay 19, 2016
  2. 1/5 string list: improve commentStefan Beller, May 19, 2016
  3. Junio C HamanoMay 19, 2016
  4. Stefan BellerMay 19, 2016
  5. 2/5 Documentation: fix a typoStefan Beller, May 19, 2016
  6. 3/5 pathspec: move long magic parsing out of prefix_pathspecStefan Beller, May 19, 2016
  7. 4/5 pathspec: move prefix check out of the inner loopStefan Beller, May 19, 2016
  8. 5/5 pathspec: allow querying for attributesStefan Beller, May 19, 2016
  9. Junio C HamanoMay 19, 2016
  10. Stefan BellerMay 19, 2016
  11. Junio C HamanoMay 19, 2016
  12. Junio C HamanoMay 19, 2016
  13. Junio C HamanoMay 19, 2016
  14. Stefan BellerMay 19, 2016
  15. Junio C HamanoMay 19, 2016
  16. Stefan BellerMay 19, 2016
  17. Junio C HamanoMay 20, 2016
  18. Stefan BellerMay 20, 2016
  19. Junio C HamanoMay 20, 2016
  20. Duy NguyenMay 22, 2016
  21. Stefan BellerMay 23, 2016
  22. Duy NguyenMay 24, 2016

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.