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

Re: [PATCH] help.c: add a compatibility comment to cmd_version()

From
Philip Oakley <philipoakley@iee.org>
Date
Apr 17, 2013, 23:03 UTC
Message-ID
<EAD161814DB34F5AAC61A9EF06873314@PhilipOakley>
In-Reply-To
<7vvc7mhzok.fsf@alter.siamese.dyndns.org>
From: "Junio C Hamano" <gitster@pobox.com>
Sent: Tuesday, April 16, 2013 11:35 PM
Show 8 quoted lines
> "Philip Oakley" <philipoakley@iee.org> writes:
>
>>> int cmd_version(int argc, const char **argv, const char *prefix)
>>> {
>>> + /*
>>> + * The format of this string should be kept stable for 
>>> compatibility
>>> + * with external projects that rely on the output of "git version".
This 'tantalizes without telling', the same complaint that is given 
often for over-succinct commit messages.
How about
    * E.g. git gui uses the extended regular expression "^git version 
[1-9]+(\.[0-9]+)+.*"
    * to check for an acceptable version string.
The ERE is from git-gui.sh:L958.
Show 8 quoted lines
>>
>> Shouldn't the expected format of our known external project also be
>> indicated?
>> ...
>>>  printf("git version %s\n", git_version_string);
>
> It is fairly clear from the commented code that the only guarantee
> they will be getting is that it begins with a string "git version ".

I read the code the opposite way. It says "This is the code to be changed" if you (anyone doing tweaks) want a special version string.

Show 10 quoted lines
> git_version_string[] has anything of the builder's choice.  I am not
> sure if there anything more to "indicate".
>
> Really, if you run
>
> $ git version
>
> and you get "Git Source Code Management Version 3.56" from its
> output, it is likely that the version is very different from what
> you know, and you should not assume any your assumption would hold.

Again I am reading this from the opposite side. There would be no assumption of difference if it _passed_ the test scripts. Unfortunately it wouldn't be friendly to other tools (like git gui). Hence my suggestion of the basic test that a "passing" git would produce a consistent version string. It still allows the supplier's suffixes to be added, but not the prefixes. The test suite tests that git is 'good enough for most usages and picks up regressions. No?

Obvious inconsistent special versions would fail in many other places.
Show 5 quoted lines
>
>> Or mention "such as git gui"?
>
> I do not see what it would buy us.  It is not like it is OK as long
> as we upadte Git gui at the same time.
Philip 
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 7 in “help.c: add a compatibility comment to cmd_version()”
  1. help.c: add a compatibility comment to cmd_version()David Aguilar, Apr 16, 2013
  2. Junio C HamanoApr 16, 2013
  3. Philip OakleyApr 16, 2013
  4. Junio C HamanoApr 16, 2013
  5. Philip OakleyApr 17, 2013
  6. Junio C HamanoApr 18, 2013
  7. Philip OakleyApr 18, 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.