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

Re: Git Future Proofing

From
Junio C Hamano <junkio@cox.net>
Date
Nov 22, 2005, 01:13 UTC
Message-ID
<7vmzjxjxi6.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<11326192921291-git-send-email-matlads@dsmagic.com>
Martin Atukunda <matlads@dsmagic.com> writes:
> Patch 2 fixes init-db's template copy so that it handles
> copying a config file.

The readdir() loop in init_db_config_check() confuses me. Why check the prefix config (and "config" has 6 bytes not 5 ;-) not just open("$template_path/config")???

> Patch 6 fixes up init-db config copying so as to never copy anything newer.
>> It however, warns if the copy will result in a downgrade of the repo format
>> version, as git tools are supposed (or will be able) to handle this case :)

I suspect that it is not enough to copy an older version of config file along with older version of templates.

Suppose version 0 had .git/remotes/{origin,linus,...} and version 1 moved that information to a flat file ".git/remotes", that has a bunch of sections like [remotes.origin] in the config file format, because we have a mechanism in your patch 5 that lets us read from more than one configuration file.

Now suppose you are running a version 1 repository, so all your remotes trees you subscribe to are described in .git/remotes file. You somehow used git-init-db to reiniailize it, using version 0 template, which has "remotes/origin" and "remotes/linus". What happens?

Template-copying is designed not to overwrite what is in the repository, so your .git/remotes file will hopefully be kept, and the configuration file now claims the repository is in version 0 format. But is it really in version 0 format? You cannot create .git/remote/frotz file in such a repository.

I think copying older one into a fresh repository might be safe, but I'd feel safer if we do not play downgrade games like this.

Previous: Martin Atukunda
Message 12 of 12 in “Git Future Proofing”
  1. Martin AtukundaNov 22, 2005
  2. 2/6 Make init-db check repo format version if copying a config file.Martin Atukunda, Nov 22, 2005
  3. 3/6 Make get_git_dir take a flag that makes it re-read the env. variablesMartin Atukunda, Nov 22, 2005
  4. 1/6 Add GIT_REPO_VERSION, and repository_format_versionMartin Atukunda, Nov 22, 2005
  5. 4/6 Add check_repo_format check for all major operations.Martin Atukunda, Nov 22, 2005
  6. Junio C HamanoNov 22, 2005
  7. Martin AtukundaNov 22, 2005
  8. Junio C HamanoNov 22, 2005
  9. Junio C HamanoNov 23, 2005
  10. 5/6 Allow Specification of the conf file to read for git_config operationsMartin Atukunda, Nov 22, 2005
  11. 6/6 Add check for downgrading of repo format version via init-dbMartin Atukunda, Nov 22, 2005
  12. Junio C HamanoNov 22, 2005

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.