Multiple worktree setup is still evolving and its behavior may be
changed in future. But we do not want to break existing worktree
setups. A new set of extensions, worktree=X, is recognized to tell Git
what multiple worktree "version" is being used so that Git can
behavior accordingly.

This extension has no use yet. The first one will be config split.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com>
---
 Documentation/git-worktree.txt                 | 12 ++++++++++++
 Documentation/technical/repository-version.txt |  6 ++++++
 cache.h                                        |  1 +
 environment.c                                  |  1 +
 setup.c                                        |  3 +++
 5 files changed, 23 insertions(+)

diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt
index 5b9ad04..048d7d6 100644
--- a/Documentation/git-worktree.txt
+++ b/Documentation/git-worktree.txt
@@ -106,6 +106,18 @@ OPTIONS
 --expire <time>::
        With `prune`, only expire unused working trees older than <time>.
 
+WORKTREE VERSIONS AND MIGRATION
+-------------------------------
+Multiple worktree is still an experimental feature and evolving. Every
+time the behavior is changed, the "worktree version" is stepped
+up. Worktree version is stored as a configuration variable
+extensions.worktree.
+
+Version 0
+~~~~~~~~~
+This is the first release. Version 0 is implied if extensions.worktree
+does not exist.
+
 DETAILS
 -------
 Each linked working tree has a private sub-directory in the repository's
diff --git a/Documentation/technical/repository-version.txt 
b/Documentation/technical/repository-version.txt
index 00ad379..e4583c5 100644
--- a/Documentation/technical/repository-version.txt
+++ b/Documentation/technical/repository-version.txt
@@ -86,3 +86,9 @@ for testing format-1 compatibility.
 When the config key `extensions.preciousObjects` is set to `true`,
 objects in the repository MUST NOT be deleted (e.g., by `git-prune` or
 `git repack -d`).
+
+`worktree`
+~~~~~~~~~~
+
+Define behavior in multiple worktree setup. The value specifies the
+version. Default version is zero.
diff --git a/cache.h b/cache.h
index dfc459c..e742c46 100644
--- a/cache.h
+++ b/cache.h
@@ -727,6 +727,7 @@ extern int grafts_replace_parents;
 #define GIT_REPO_VERSION_READ 1
 extern int repository_format_version;
 extern int repository_format_precious_objects;
+extern int repository_format_worktree_version;
 extern int check_repository_format(void);
 
 #define MTIME_CHANGED  0x0001
diff --git a/environment.c b/environment.c
index 1cc4aab..1bd4a56 100644
--- a/environment.c
+++ b/environment.c
@@ -27,6 +27,7 @@ int warn_on_object_refname_ambiguity = 1;
 int ref_paranoia = -1;
 int repository_format_version;
 int repository_format_precious_objects;
+int repository_format_worktree_version;
 const char *git_commit_encoding;
 const char *git_log_output_encoding;
 int shared_repository = PERM_UMASK;
diff --git a/setup.c b/setup.c
index d343725..2f41648 100644
--- a/setup.c
+++ b/setup.c
@@ -373,6 +373,9 @@ static int check_repo_format(const char *var, const char 
*value, void *cb)
                        ;
                else if (!strcmp(ext, "preciousobjects"))
                        repository_format_precious_objects = 
git_config_bool(var, value);
+               else if (!strcmp(ext, "worktree"))
+                       repository_format_worktree_version =
+                               git_config_ulong(var, value);
                else
                        string_list_append(&unknown_extensions, ext);
        }
-- 
2.7.0.288.g1d8ad15

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to