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

Re: [PATCH v2 1/8] t4051: rewrite, add more tests

From
Junio C Hamano <gitster@pobox.com>
Date
May 29, 2016, 23:55 UTC
Message-ID
<xmqqinxwpgfn.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<5749B1EA.10707@web.de>
René Scharfe <l.s.r@web.de> writes:
> +commit_and_tag () {
> +	message=$1 &&
> +	shift &&
> +	git add $@ &&

Lack of dq around $@ makes me wonder if there is something funny going on (looking at the callers, there isn't, so we'd better quote it to avoid wasting time, I think).

> +	test_tick &&
> +	git commit -m $message &&
> +	git tag $message
>  }

The use of $message as the sole argument to "git tag" makes the readers guess that it must be a single token without any funny character, so the readers would probably do not waste too much time wondreing if the lack of dq around $message in the last two is problematic.

> +last_context_line () {
> +	sed -n '$ p'
>  }

I have a vague recollection that some implementations of sed are unhappy to see that space between the address and the operation; I'd feel safer without it.

Show 12 quoted lines
> +check_diff () {
> +	name=$1
> +	desc=$2
> +	options="-W $3"
> +
> +	test_expect_success "$desc" '
> +		git diff $options "$name^" "$name" >"$name.diff"
> +	'
> +
> +	test_expect_success ' diff applies' '
> +		test_when_finished "git reset --hard" &&
> +		git checkout --detach "$name^" &&

With the presence of ^ there, --detach is unnecessary; it would not hurt, though.

> +		git apply "$name.diff" &&
> +		git diff --exit-code "$name"

Even though we may know that $name.diff" will never have a creation of new paths, I'd feel safer if "apply" is run with "--index".

Thanks.
Previous: René ScharfeNext: René Scharfe
Message 16 of 27 in “[Bug?] log -p -W showing the whole file for a patch that adds to the end?”
  1. Junio C HamanoMay 10, 2016
  2. Junio C HamanoMay 10, 2016
  3. René ScharfeMay 12, 2016
  4. René ScharfeMay 21, 2016
  5. 1/5 diff: factor out match_func_rec()René Scharfe, May 21, 2016
  6. 2/5 diff: handle appended chunks better with -WRené Scharfe, May 21, 2016
  7. 3/5 diff: ignore empty lines before added functions with -WRené Scharfe, May 21, 2016
  8. 4/5 diff: don't include common trailing empty lines with -WRené Scharfe, May 21, 2016
  9. 5/5 grep: don't extend context to trailing empty lines with -WRené Scharfe, May 21, 2016
  10. Junio C HamanoMay 24, 2016
  11. René ScharfeMay 26, 2016
  12. Junio C HamanoMay 26, 2016
  13. René ScharfeMay 27, 2016
  14. René ScharfeMay 28, 2016
  15. 1/8 t4051: rewrite, add more testsRené Scharfe, May 28, 2016
  16. Junio C HamanoMay 29, 2016
  17. René ScharfeMay 30, 2016
  18. 1/8 t4051: rewrite, add more testsRené Scharfe, May 31, 2016
  19. René ScharfeMay 31, 2016
  20. Junio C HamanoMay 31, 2016
  21. 2/8 xdiff: factor out match_func_rec()René Scharfe, May 28, 2016
  22. 3/8 xdiff: handle appended chunks better with -WRené Scharfe, May 28, 2016
  23. 4/8 xdiff: ignore empty lines before added functions with -WRené Scharfe, May 28, 2016
  24. 5/8 xdiff: -W: don't include common trailing empty lines in contextRené Scharfe, May 28, 2016
  25. 6/8 xdiff: don't trim common tail with -WRené Scharfe, May 28, 2016
  26. 7/8 t7810: add test for grep -W and trailing empty context linesRené Scharfe, May 28, 2016
  27. 8/8 grep: -W: don't extend context to trailing empty linesRené Scharfe, May 28, 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.