Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-08-25 00:54:28 +0300
committerJunio C Hamano <gitster@pobox.com>2020-08-25 00:54:28 +0300
commita654836d96aced223bfbee57bd2ac1989eb6d77f (patch)
tree029067273ef10b890748f59404ce978618653980 /builtin
parent675a4aaf3b226c0089108221b96559e0baae5de9 (diff)
parentccf236a23adb5cfb4e5285daad083149458d7828 (diff)
Merge branch 'es/init-no-separate-git-dir-in-bare'
The purpose of "git init --separate-git-dir" is to initialize a new project with the repository separate from the working tree, or, in the case of an existing project, to move the repository (the .git/ directory) out of the working tree. It does not make sense to use --separate-git-dir with a bare repository for which there is no working tree, so disallow its use with bare repositories. * es/init-no-separate-git-dir-in-bare: init: disallow --separate-git-dir with bare repository
Diffstat (limited to 'builtin')
-rw-r--r--builtin/init-db.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/builtin/init-db.c b/builtin/init-db.c
index f70076d38e..bbc9bc78f9 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -563,6 +563,9 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
argc = parse_options(argc, argv, prefix, init_db_options, init_db_usage, 0);
+ if (real_git_dir && is_bare_repository_cfg == 1)
+ die(_("--separate-git-dir and --bare are mutually exclusive"));
+
if (real_git_dir && !is_absolute_path(real_git_dir))
real_git_dir = real_pathdup(real_git_dir, 1);
@@ -658,6 +661,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
get_git_work_tree());
}
else {
+ if (real_git_dir)
+ die(_("--separate-git-dir incompatible with bare repository"));
if (work_tree)
set_git_work_tree(work_tree);
}