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

Re: [PATCH] fast-import: properly fanout notes when tree is imported

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 20, 2016, 20:56 UTC
Message-ID
<xmqqbmw6jp59.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20161220204841.awvabgwsxudxfzca@glandium.org>
Mike Hommey <mh@glandium.org> writes:
Show 28 quoted lines
> On Tue, Dec 20, 2016 at 11:34:04AM -0800, Junio C Hamano wrote:
>> Mike Hommey <mh@glandium.org> writes:
>> 
>> > In typical uses of fast-import, trees are inherited from a parent
>> > commit. In that case, the tree_entry for the branch looks like:
>> > ...
>> > +# Create another notes tree from the one above
>> > +cat >>input <<INPUT_END
>> > +...
>> > +M 040000 $(git log --no-walk --format=%T refs/notes/many_notes) 
>> 
>> There is a trailing SP that cannot be seen by anybody.
>> 
>> Don't do this.  It makes it very easy to miss what is going on and
>> wastes reviewers' time.
>> 
>> Protect it by doing something like:
>> 
>> 	sed -e 's/Z$//' >>input <<INPUT_END
>> 	...
>> 	M 040000 $(git log --no-walk --format=%T refs/notes/many_notes) Z
>
> How about
> EMPTY=
> ...
> M 040000 $(git log --no-walk --format=%T refs/notes/many_notes) $EMPTY
>
> ?
Notice I said "something like" ;-)

I think you are bringing that up to avoid sed, but if you want to go that route, the long string $EMPTY is distracting, and makes readers wonder why something that is loud but expands to nothing has to be there. It hides the true intention, which is that the SP that comes before it is the most important thing on that line.

I would think a lot more understandable variant would be to do this instead:

	SP=" "
	...
	M a lot of garbage $(and command)$SP
Previous: Mike HommeyNext: Mike Hommey
Message 5 of 8 in “fast-import: properly fanout notes when tree is imported”
  1. fast-import: properly fanout notes when tree is importedMike Hommey, Dec 19, 2016
  2. Johan HerlandDec 19, 2016
  3. Junio C HamanoDec 20, 2016
  4. Mike HommeyDec 20, 2016
  5. Junio C HamanoDec 20, 2016
  6. fast-import: properly fanout notes when tree is importedMike Hommey, Dec 20, 2016
  7. Mike HommeyDec 20, 2016
  8. Junio C HamanoDec 20, 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.