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

Re: [RFC/PATCH 0/2] Test the Git version string

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 16, 2013, 19:02 UTC
Message-ID
<7vip3ml2on.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CAJDDKr7WKwt10sCRTbm8gdhwEUKSYuQxtPDVm7usTm2ZHryk9g@mail.gmail.com>
David Aguilar <davvid@gmail.com> writes:
Show 11 quoted lines
> The "regression" is that there are scripts and tools in the wild that
> need to know the git version when deciding whether or not to use some
> new feature.
>
> e.g. "git status --ignore-submodules=dirty" did not appear until git 1.7.2.
> A script may want to use this flag, but it will only want to use it
> when available.
>
> If this string started saying "The Git Version Control System v2.0" then these
> scripts would be "broken" since they would no longer recognize this as a
> "post-1.7.2 Git".

Blacklisting known-bad version and hoping all other versions including the ones you have never seen to behave in the way you expect usually works but there is a limit.

A change to say "The Git Version Control System %s" will not happen willy-nilly, but when there is a good reason to do so, we would.

I do not think a test that hardcodes the output is a good way to make sure a change is being done with a good reason. After all, a patch that updates the "git version %s" string can just update the expected output in the same patch. The only reason such a change will be caught is because during the review, somebody notices that the change touches the expected output of a test; for that to reliably protect the output, the test *has* to be commented to say that this expected output should be changed very carefully.

A much better solution would be to leave that "very carefully" comment next to the in-code string to warn people about ramifiations of changing it.

Previous: David AguilarNext: Philip Oakley
Message 10 of 11 in “Test the Git version string”
  1. 0/2 Test the Git version stringPhilip Oakley, Apr 14, 2013
  2. 1/2 test git version stringPhilip Oakley, Apr 14, 2013
  3. 2/2 Doc: State the exact git version stringPhilip Oakley, Apr 14, 2013
  4. Junio C HamanoApr 14, 2013
  5. Philip OakleyApr 14, 2013
  6. Junio C HamanoApr 15, 2013
  7. Philip OakleyApr 16, 2013
  8. Junio C HamanoApr 16, 2013
  9. David AguilarApr 16, 2013
  10. Junio C HamanoApr 16, 2013
  11. Philip OakleyApr 16, 2013

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.