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

Re: [PATCH v2 0/2] t/helper/test-tool: implement 'sha1-unsafe' helper

From
Jeff King <peff@peff.net>
Date
Nov 8, 2024, 17:23 UTC
Message-ID
<20241108172323.GC548990@coredump.intra.peff.net>
In-Reply-To
<Zy0yRLt5dM554yq1@nand.local>
On Thu, Nov 07, 2024 at 04:33:56PM -0500, Taylor Blau wrote:
Show 21 quoted lines
> >   # Compute and append pack trailer to "$1"
> >   pack_trailer () {
> >   	test-tool $(test_oid algo) -b <"$1" >trailer.tmp &&
> >   	cat trailer.tmp >>"$1" &&
> >   	rm -f trailer.tmp
> >   }
> 
> Nice find. I think that it may be worth writing this as:
> 
>     case "$(test_oid algo)" in
>     sha1)
>         test-tool sha1 -b <"$1" >trailer.tmp
>         ;;
>     sha256)
>         test-tool sha256 -b <"$1" >trailer.tmp
>         ;;
>     *)
>         echo >&2 "unknown algorithm: $(test_oid algo)"
>         exit 1
>         ;;
>     esac

If it were "test-tool hash --algo=$(test_oid algo)", then presumably test-tool would naturally do the same switch and error message internally.

-Peff
Previous: Taylor BlauNext: Jeff King
Message 16 of 19 in “t/helper/test-tool: implement 'sha1-unsafe' helper”
  1. 0/2 t/helper/test-tool: implement 'sha1-unsafe' helperTaylor Blau, Nov 5, 2024
  2. 1/2 t/helper/test-sha1: prepare for an unsafe modeTaylor Blau, Nov 5, 2024
  3. Junio C HamanoNov 6, 2024
  4. brian m. carlsonNov 7, 2024
  5. Jeff KingNov 7, 2024
  6. brian m. carlsonNov 7, 2024
  7. Jeff KingNov 7, 2024
  8. Junio C HamanoNov 7, 2024
  9. Taylor BlauNov 7, 2024
  10. Taylor BlauNov 7, 2024
  11. Jeff KingNov 8, 2024
  12. 2/2 t/helper/test-tool: implement sha1-unsafe helperTaylor Blau, Nov 5, 2024
  13. Jeff KingNov 7, 2024
  14. brian m. carlsonNov 7, 2024
  15. Taylor BlauNov 7, 2024
  16. Jeff KingNov 8, 2024
  17. Jeff KingNov 8, 2024
  18. Taylor BlauNov 7, 2024
  19. Jeff KingNov 8, 2024

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.