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

Re: [PATCH] contrib/subtree: Remove --annotate

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 5, 2016, 17:33 UTC
Message-ID
<xmqqsi2cj5hu.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<1451963101-4901-2-git-send-email-greened@obbligato.org>
David Greene <greened@obbligato.org> writes:
Show 9 quoted lines
> From: "David A. Greene" <greened@obbligato.org>
>
> Remove --annotate.  This obviates the need for an --unannotate
> command, which is both an obvious addition and difficult to define
> due to the numerous ways one might want to specify how to edit
> commit messages.  git has other tools more suited to rewriting
> commit messages and it's easy enough to use them after a subtree
> split.  Such tools include filter-branch, rebase -i and
> commit --amend.

I do not think that "there are other ways to do this" is a good justification for removing a feature, unless it can be shown that nobody is using it, of course.

Show 6 quoted lines
> @@ -319,7 +315,7 @@ copy_commit()
>  			GIT_COMMITTER_NAME \
>  			GIT_COMMITTER_EMAIL \
>  			GIT_COMMITTER_DATE
> -		(printf "%s" "$annotate"; cat ) |
> +		(echo -n ""; cat ) |

I can see that by changing "printf something" with 'echo -n ""', you are making it clear that we are stopping to add that something to the pipeline, but (1) I think the intended effect of running 'echo -n' on an empty string is to do nothing, and (2) 'echo -n' is not portable [*1*], so this leaves a puzzling code that makes future readers scratch their heads.

I wonder why this cannot be simply the removal of the entire line, making the resulting implementation more like this:

                git log -1 --pretty=format:... "$1" |
                (
                        read ... various variables ...
                        export ... various variables ...
        -		(printf "%s" "$annotate"; cat ) |
                        git commit-tree "$2" $3 # reads the rest of stdin
                ) || die "cannot copy"

That is, just feed the remainder of what is coming directly to the command?

[Footnote]
*1* http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html

says """Implementations shall not support any options."""; '-n' comes from BSD and SysV way of supressing the final newline is to end the string with "\c".

Previous: David GreeneNext: David A. Greene
Message 3 of 8 in “Remote subtree split --annotate”
  1. Remote subtree split --annotateDavid Greene, Jan 5, 2016
  2. contrib/subtree: Remove --annotateDavid Greene, Jan 5, 2016
  3. Junio C HamanoJan 5, 2016
  4. David A. GreeneJan 5, 2016
  5. Junio C HamanoJan 15, 2016
  6. David A. GreeneJan 17, 2016
  7. Junio C HamanoJan 18, 2016
  8. David A. GreeneJun 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.