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

Re: [PATCH] builtins: reset startup_info->have_run_setup_gitdir when unsetting up repository

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Mar 28, 2010, 07:11 UTC
Message-ID
<fcaeb9bf1003280011r4c25a076t22d8759de31c3e3f@mail.gmail.com>
In-Reply-To
<20100327223813.GA5809@progeny.tock>
2010/3/27 Jonathan Nieder <jrnieder@gmail.com>:
Show 35 quoted lines
> Hi again,
>
> Nguyễn Thái Ngọc Duy wrote:
>
>> While at it, also reset repository_format_version to zero. When
>> omitted, the format should be understood as the last supported
>> version, i.e. zero. This is probably only used by "git init" or "git
>> clone".
> [...]
>>       /* Initialized in check_repository_format_version() */
>> -     repository_format_version = 0xFF;
>> +     repository_format_version = 0;
>
> Good change, but wrong justification in my opinion.
>
> v0.99.9l^2~54 (init-db: check template and repository format.,
> 2005-11-25) taught ‘git init-db’ to make sure that
>
>  repository_format_version <= GIT_REPO_VERSION
>
> before initializing a new repository.  repository_format_version was
> being explicitly initialized globally to 0 at the time, presumably to
> ensure tests like this always succeed when no repository format version
> is declared (or in other words, the repository format for repositories
> initialized before git v0.99.9l^2~56 is zero by convention).  As a happy
> side effect, that default takes care of the “no pre-existing repository”
> case here.
>
> The explicit initialization was removed in commit v1.4.3-rc1~230 (remove
> unnecessary initializations, 2006-08-15), since according to ANSI C it
> is redundant.
>
> So I think the convention is not “if in doubt, the repository has
> version GIT_REPO_VERSION” but “if the repository lacks a
> core.repositoryversion setting, it must be really old”.

Makes sense. Thanks. Will leave a note at the initialization to reduce history digging time for other people.

-- 
Duy
Previous: Jonathan NiederNext: Jonathan Nieder
Message 4 of 5 in “builtins: setup repository before print unknown command error”
  1. builtins: setup repository before print unknown command errorNguyễn Thái Ngọc Duy, Mar 27, 2010
  2. builtins: reset startup_info->have_run_setup_gitdir when unsetting up repositoryNguyễn Thái Ngọc Duy, Mar 27, 2010
  3. Jonathan NiederMar 27, 2010
  4. Nguyen Thai Ngoc DuyMar 28, 2010
  5. Jonathan NiederMar 28, 2010

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.