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

Re: [PATCH v2 1/4] t7401: modernize style

From
Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Date
Aug 13, 2020, 08:06 UTC
Message-ID
<c70f7bb5d1289f5318da7b99e41cf5828a451174.camel@gmail.com>
In-Reply-To
<20200812192737.13971-2-shouryashukla.oo@gmail.com>
On Thu, 2020-08-13 at 00:57 +0530, Shourya Shukla wrote:
Show 7 quoted lines
>
> [...]
>
> Using a Git command in the upstream of a pipe might result in us
> losing its exit code. So, convert such usages so that they write to
> a file and read from them.
> 

While that is a good enough reason to avoid using pipes in places where we look for the exit code of a command like within test_expect_success, I'm not sure if that reason holds for the places that the patch changes.

Show 20 quoted lines
> [...]
>
> diff --git a/t/t7401-submodule-summary.sh b/t/t7401-submodule-
> summary.sh
> index 9bc841d085..8ee78bcb69 100755
> --- a/t/t7401-submodule-summary.sh
> +++ b/t/t7401-submodule-summary.sh
> @@ -16,12 +16,13 @@ add_file () {
>  	owd=$(pwd)
>  	cd "$sm"
>  	for name; do
> -		echo "$name" > "$name" &&
> +		echo "$name" >"$name" &&
>  		git add "$name" &&
>  		test_tick &&
>  		git commit -m "Add $name"
>  	done >/dev/null
> -	git rev-parse --verify HEAD | cut -c1-7
> +	git rev-parse --verify HEAD >out &&
> +	cut -c1-7 out

In any case, I believe we can avoid the 'cut' altogether in both places by doing something like this instead:

   git rev-parse --short=7 HEAD
My quick check shows the test script is happy with this change.
Show 13 quoted lines
>  	cd "$owd"
>  }
>  commit_file () {
> @@ -125,7 +126,8 @@ commit_file sm1 &&
>  head3=$(
>  	cd sm1 &&
>  	git reset --hard HEAD~2 >/dev/null &&
> -	git rev-parse --verify HEAD | cut -c1-7
> +	git rev-parse --verify HEAD >out &&
> +	cut -c1-7 out
>  )
>  
>  test_expect_success 'modified submodule(backward)' "
-- 
Sivaraam
Previous: Shourya ShuklaNext: Junio C Hamano
Message 24 of 33 in “t7401: modernize, cleanup and warn”
  1. Shourya ShuklaAug 5, 2020
  2. 3/4 t7401: ensure uniformity in the '--for-status' testShourya Shukla, Aug 5, 2020
  3. Taylor BlauAug 5, 2020
  4. Junio C HamanoAug 5, 2020
  5. Taylor BlauAug 5, 2020
  6. Junio C HamanoAug 5, 2020
  7. Shourya ShuklaAug 6, 2020
  8. Junio C HamanoAug 6, 2020
  9. 4/4 t7401: add a WARNING and a NEEDSWORKShourya Shukla, Aug 5, 2020
  10. Taylor BlauAug 5, 2020
  11. Junio C HamanoAug 5, 2020
  12. Shourya ShuklaAug 6, 2020
  13. Junio C HamanoAug 6, 2020
  14. Christian CouderAug 7, 2020
  15. 2/4 t7401: change test_i18ncmp syntax for clarityShourya Shukla, Aug 5, 2020
  16. Taylor BlauAug 5, 2020
  17. Junio C HamanoAug 5, 2020
  18. 1/4 t7401: modernize styleShourya Shukla, Aug 5, 2020
  19. Denton LiuAug 5, 2020
  20. Taylor BlauAug 5, 2020
  21. Shourya ShuklaAug 6, 2020
  22. [GSoC][PATCH v2 0/4] t7401: modernize, cleanup and moreShourya Shukla, Aug 12, 2020
  23. 1/4 t7401: modernize styleShourya Shukla, Aug 12, 2020
  24. Kaartic SivaraamAug 13, 2020
  25. Junio C HamanoAug 13, 2020
  26. Shourya ShuklaAug 14, 2020
  27. Junio C HamanoAug 14, 2020
  28. 2/4 t7401: change test_i18ncmp syntax for clarityShourya Shukla, Aug 12, 2020
  29. Junio C HamanoAug 12, 2020
  30. Junio C HamanoAug 12, 2020
  31. Shourya ShuklaAug 14, 2020
  32. 3/4 t7401: change indentation for enhanced readabilityShourya Shukla, Aug 12, 2020
  33. 4/4 t7401: add a NEEDSWORKShourya Shukla, Aug 12, 2020

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.