summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2015-04-10 11:33:14 +0200
committerEdward Thomson <ethomson@edwardthomson.com>2015-04-10 11:33:14 +0200
commit63af449e24125b050dbad3530c3ec64e2e4ee754 (patch)
tree80dc1c42672ce78f74b4d1db44bcbd628d42968a /src
parent8932c32c21c0dbe4bcb81205dded45446ecd9934 (diff)
parent7c2a2172b85873c67f989ab55e0bde6ff83d8c38 (diff)
downloadlibgit2-63af449e24125b050dbad3530c3ec64e2e4ee754.tar.gz
Merge pull request #3030 from linquize/symlink_supported
If work_dir is not specified, use repo_dir to test if symlink is supported
Diffstat (limited to 'src')
-rw-r--r--src/repository.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/repository.c b/src/repository.c
index 7cffc9f6b..c608fa0b8 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -1608,6 +1608,7 @@ int git_repository_init_ext(
{
int error;
git_buf repo_path = GIT_BUF_INIT, wd_path = GIT_BUF_INIT;
+ const char *wd;
assert(out && given_repo && opts);
@@ -1617,6 +1618,7 @@ int git_repository_init_ext(
if (error < 0)
goto cleanup;
+ wd = (opts->flags & GIT_REPOSITORY_INIT_BARE) ? NULL : git_buf_cstr(&wd_path);
if (valid_repository_path(&repo_path)) {
if ((opts->flags & GIT_REPOSITORY_INIT_NO_REINIT) != 0) {
@@ -1629,15 +1631,15 @@ int git_repository_init_ext(
opts->flags |= GIT_REPOSITORY_INIT__IS_REINIT;
error = repo_init_config(
- repo_path.ptr, wd_path.ptr, opts->flags, opts->mode);
+ repo_path.ptr, wd, opts->flags, opts->mode);
/* TODO: reinitialize the templates */
}
else {
if (!(error = repo_init_structure(
- repo_path.ptr, wd_path.ptr, opts)) &&
+ repo_path.ptr, wd, opts)) &&
!(error = repo_init_config(
- repo_path.ptr, wd_path.ptr, opts->flags, opts->mode)))
+ repo_path.ptr, wd, opts->flags, opts->mode)))
error = repo_init_create_head(
repo_path.ptr, opts->initial_head);
}