git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] builtins: reset startup_info->have_run_setup_gitdir when unsetting up repository
Date: Sat, 27 Mar 2010 17:38:13 -0500	[thread overview]
Message-ID: <20100327223813.GA5809@progeny.tock> (raw)
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

  reply	other threads:[~2010-03-27 22:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-27  9:13 [PATCH] builtins: setup repository before print unknown command error Nguyễn Thái Ngọc Duy
2010-03-27  9:13 ` [PATCH] builtins: reset startup_info->have_run_setup_gitdir when unsetting up repository Nguyễn Thái Ngọc Duy
2010-03-27 22:38   ` Jonathan Nieder [this message]
2010-03-28  7:11     ` Nguyen Thai Ngoc Duy
2010-03-28  0:34   ` Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100327223813.GA5809@progeny.tock \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).