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

Re: [PATCH v4 2/2] commit-tree: add missing --gpg-sign flag

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 22, 2019, 19:07 UTC
Message-ID
<xmqqzhrsfr4c.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CAN0heSr3a9H46j3wiTwwbw7HFh4+4aFs5-qe=gtxYB3vC73KAA@mail.gmail.com>
Martin Ågren <martin.agren@gmail.com> writes:
Show 10 quoted lines
>> +       echo 11 | git commit-tree --gpg-sign HEAD^{tree} >oid &&
>> +       test_line_count = 1 oid &&
>> +       git tag eleventh-signed $(cat oid) &&
>> +...
> Let's see if there any opinions from others about this more verbose
> construction, vs placing the oid in a variable and quoting it. We
> obviously went several years without realizing that using $(...) as an
> object id risked falling back to HEAD and that a completely broken `git
> commit-tree -S` would pass the test. So being over-careful and extra
> obvious might very well be the right thing.

Sorry, but I am not sure what issue you are worried about. If the "commit-tree" command failed in this construct:

	oid=$(echo 11 | git commit-tree ...) &&
	git tag eleventh-signed "$oid"

wouldn't the &&-chain break after the assignment of an empty string to oid, skip "git tag" and make the whole test fail, with or without '$oid" fed to "git tag" quoted? It is wrong not to quote "$oid" for the "git tag" command (the test should not rely on the fact that the object names given by "git commit-tree" have no $IFS in them), but that is a separate issue.

Previous: Martin ÅgrenNext: Martin Ågren
Message 4 of 5 in “t7510: invoke git as part of &&-chain”
  1. 1/2 t7510: invoke git as part of &&-chainBrandon Richardson, Jan 19, 2019
  2. 2/2 commit-tree: add missing --gpg-sign flagBrandon Richardson, Jan 19, 2019
  3. Martin ÅgrenJan 20, 2019
  4. Junio C HamanoJan 22, 2019
  5. Martin ÅgrenJan 22, 2019

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.