Re: Git Future Proofing
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:13
Martin Atukunda [off-list ref] 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.
quoted
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.