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

Re: [PATCH] t4014-format-patch: Adjust git_version regex to better handle distro changes to DEF_VER

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 10, 2016, 16:42 UTC
Message-ID
<xmqqpon8gnp3.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20161010025323.9415-1-jeremyhu@apple.com>
Jeremy Huddleston Sequoia <jeremyhu@apple.com> writes:
> Regressed-in: 480871e09ed2e5275b4ba16b278681e5a8c122ae

Please be considerate to future readers of "git log" to help them avoid mistakes earlier commits made that caused you troubles.

This line by itself without any explanation of what was broken is quite useless as a commit message. What can the readers do? They'd go back and say "git show 480871e09" and then what? The test added or modified by the commit has been working quite well for others since it was made, so it is very likely the reader wouldn't be able to tell if anything is wrong in it.

You would help if you said what is different in _your_ environment from others who have happily been running and passing this test for others to understand and learn from your fix. What is it?

The "Adjust ... distro changes" in the title offers some hint but it could be more explicit. Please write something along this line instead.

    Subject: t4014: git --version can have SP in it
    480871e09e ("format-patch: show base info before email
    signature", 2016-09-07) added a helper function to recreate the
    signature at the end of the e-mail, i.e. "-- " line followed by
    the version string of Git, using output from "git --version" and
    stripping everything before the last SP.
    Because the default Git version string looks like "git version
    2.10.0-1-g480871e09e", this was mostly OK, but people can change
    this version string to arbitrary thing while compiling, which
    can break the assumption if they had SP in it.  Notably, Apple
    ships modified Git with " (Apple Git-xx)" appended to its
    version number.
    Instead, come up with the version string by stripping the "git
    version " from the beginning.
> Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Good.
> CC: Josh Triplett <josh@joshtriplett.org>
> CC: Junio C Hamano <gitster@pobox.com>

Please don't do this in your log message. These belong to your e-mail headers, not here.

Show 14 quoted lines
> ---
>  t/t4014-format-patch.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
> index 8d90a6e..33f6940 100755
> --- a/t/t4014-format-patch.sh
> +++ b/t/t4014-format-patch.sh
> @@ -754,7 +754,7 @@ test_expect_success 'format-patch --ignore-if-in-upstream HEAD' '
>  	git format-patch --ignore-if-in-upstream HEAD
>  '
>  
> -git_version="$(git --version | sed "s/.* //")"
> +git_version="$(git --version | sed "s/git version //")"

Anchor the fixed prefix to the beginning, so that we can protect ourselves from another distro that would add "git version" in the middle of their arbitrary versioning scheme ;-). I.e.

    sed "s/^git version //"
>  
>  signature() {
>  	printf "%s\n%s\n\n" "-- " "${1:-$git_version}"
Previous: Junio C HamanoNext: Jeremy Huddleston Sequoia
Message 7 of 9 in “t4014-format-patch: Adjust git_version regex to better handle distro changes to DEF_VER”
  1. t4014-format-patch: Adjust git_version regex to better handle distro changes to DEF_VERJeremy Huddleston Sequoia, Oct 10, 2016
  2. Josh TriplettOct 10, 2016
  3. Jeremy Huddleston SequoiaOct 10, 2016
  4. Jeff KingOct 10, 2016
  5. Jeremy Huddleston SequoiaOct 10, 2016
  6. Junio C HamanoOct 10, 2016
  7. Junio C HamanoOct 10, 2016
  8. Jeremy Huddleston SequoiaOct 10, 2016
  9. Eric WongOct 11, 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.