Re: [PATCH 4/6] Add check_repo_format check for all major operations.
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:13
Martin Atukunda [off-list ref] writes:
quoted
that call in the current series yet. Even if you had, this does not feel quite right to me.would something like the following apply in this case: (totally untested :)
Yes, although that is exactly what I said "this does not quite feel right" ;-). Is it hard to arrange things so that a process does exactly one check_repo_format() during its lifetime? Two more issues I've been thinking about: 1. The core.repositoryformatversion scheme assumes and relies on that at least .git/config would stay forward compatible. But if you cover unconditionally the three main entry points, I suspect "git-var" or "git-config-set --get" would stop working in a wrong repository. I think the scripts and Porcelains need a way to check if we are on a repository from the correct vintage before running other low-level commands, so one of these commands probably needs to be made to work without check_repo_format() dying. Or we could introduce a new command 'git-check-repo-format' for this specific purpose, and special case only that one. 2. Some commands are read-only and are handy for problem diagnosis (e.g. cat-file), so it _might_ make sense to allow them to attempt running in a newer repository (which may well fail due to repository format difference). I am not sure about the merit of doing that outweighs the complexity, though. What you did covers _everything_ uniformly, and certainly is simpler, easier to explain, and nicer.