[PATCH v3 23/24] introduce GIT_INDEX_VERSION environment variable
- From
Thomas Gummerer <t.gummerer@gmail.com>
- Date
- Aug 18, 2013, 19:42 UTC
- Message-ID
- <1376854933-31241-24-git-send-email-t.gummerer@gmail.com>
- In-Reply-To
- <1376854933-31241-1-git-send-email-t.gummerer@gmail.com>
Respect a GIT_INDEX_VERSION environment variable, when a new index is initialized. Setting the environment variable will not cause existing index files to be converted to another format for additional safety.
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> --- read-cache.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/read-cache.c b/read-cache.c index 1d9b615..f820d8a 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1235,8 +1235,13 @@ static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int reall void initialize_index(struct index_state *istate, int version) { istate->initialized = 1; - if (!version) - version = INDEX_FORMAT_DEFAULT; + if (!version) { + char *envversion = getenv("GIT_INDEX_VERSION"); + if (!envversion) + version = INDEX_FORMAT_DEFAULT; + else + version = atoi(envversion); + } istate->version = version; set_istate_ops(istate); }
-- 1.8.3.4.1231.g9fbf354.dirty