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/technical/repository-version.txt | 6 ++++++
 cache.h                                        | 1 +
 environment.c                                  | 1 +
 setup.c                                        | 3 +++
 4 files changed, 11 insertions(+)

diff --git a/Documentation/technical/repository-version.txt 
b/Documentation/technical/repository-version.txt
index 00ad379..c680528 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 c63fcc1..fa0a64b 100644
--- a/cache.h
+++ b/cache.h
@@ -725,6 +725,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 2da7fe2..a3f17ed 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.3.0.rc1.137.g477eb31

--
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