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
Jonathan Nieder <jrnieder@gmail.com>
Date
Mar 27, 2010, 22:38 UTC
Message-ID
<20100327223813.GA5809@progeny.tock>
In-Reply-To
<1269681184-1992-2-git-send-email-pclouds@gmail.com>
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”.

Jonathan
Previous: Nguyễn Thái Ngọc DuyNext: Nguyen Thai Ngoc Duy
Message 3 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.