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>2019-09-30 07:19:26 +0300
committerJunio C Hamano <gitster@pobox.com>2019-09-30 07:19:26 +0300
commitb57a88a5f1555de6d34d162a1a5a8a6deda8018e (patch)
tree412980ab401aa377cc0122bc9fa9bd9405f67191 /setup.c
parent6f21347f118f6c0c49d10485aa4bc1daaddee303 (diff)
parent5cf7b3b1acf2e603d92132906bc6929141172d4c (diff)
Merge branch 'js/gitdir-at-unc-root'
On Windows, the root level of UNC share is now allowed to be used just like any other directory. * js/gitdir-at-unc-root: setup_git_directory(): handle UNC root paths correctly Fix .git/ discovery at the root of UNC shares setup_git_directory(): handle UNC paths correctly
Diffstat (limited to 'setup.c')
-rw-r--r--setup.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/setup.c b/setup.c
index 25a3038277..e2a479a64f 100644
--- a/setup.c
+++ b/setup.c
@@ -798,7 +798,7 @@ static const char *setup_discovered_git_dir(const char *gitdir,
set_git_dir(gitdir);
inside_git_dir = 0;
inside_work_tree = 1;
- if (offset == cwd->len)
+ if (offset >= cwd->len)
return NULL;
/* Make "offset" point past the '/' (already the case for root dirs) */
@@ -920,7 +920,7 @@ static enum discovery_result setup_git_directory_gently_1(struct strbuf *dir,
const char *env_ceiling_dirs = getenv(CEILING_DIRECTORIES_ENVIRONMENT);
struct string_list ceiling_dirs = STRING_LIST_INIT_DUP;
const char *gitdirenv;
- int ceil_offset = -1, min_offset = has_dos_drive_prefix(dir->buf) ? 3 : 1;
+ int ceil_offset = -1, min_offset = offset_1st_component(dir->buf);
dev_t current_device = 0;
int one_filesystem = 1;
@@ -948,6 +948,12 @@ static enum discovery_result setup_git_directory_gently_1(struct strbuf *dir,
if (ceil_offset < 0)
ceil_offset = min_offset - 2;
+ if (min_offset && min_offset == dir->len &&
+ !is_dir_sep(dir->buf[min_offset - 1])) {
+ strbuf_addch(dir, '/');
+ min_offset++;
+ }
+
/*
* Test in the following order (relative to the dir):
* - .git (file containing "gitdir: <path>")