From: Nguyen Thai Ngoc Duy Date: Sun, 28 Mar 2010 07:11:21 GMT Subject: Re: [PATCH] builtins: reset startup_info->have_run_setup_gitdir when unsetting up repository Message-ID: In-Reply-To: <20100327223813.GA5809@progeny.tock> 2010/3/27 Jonathan Nieder : > 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