diff options
author | Ariel Davis <ariel.z.davis@icloud.com> | 2017-06-16 21:02:26 -0400 |
---|---|---|
committer | Ariel Davis <ariel.z.davis@icloud.com> | 2017-06-19 08:38:12 -0400 |
commit | 9a46c77739e9add922fca8f7798786a6bd2893e8 (patch) | |
tree | 6d505d411da46238cdaa146e849887ab3fc005e0 | |
parent | 8e912e79b4fc894b6fdbebc2dcabe944fb9b938b (diff) | |
download | libgit2-9a46c77739e9add922fca8f7798786a6bd2893e8.tar.gz |
repository: do not initialize templates if dir is an empty string
-rw-r--r-- | src/repository.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/repository.c b/src/repository.c index 7ecb00ed8..197ce6ac0 100644 --- a/src/repository.c +++ b/src/repository.c @@ -1784,7 +1784,13 @@ static int repo_init_structure( default_template = true; } - if (tdir) { + /* + * If tdir was the empty string, treat it like tdir was a path to an + * empty directory (so, don't do any copying). This is the behavior + * that git(1) exhibits, although it doesn't seem to be officially + * documented. + */ + if (tdir && git__strcmp(tdir, "") != 0) { uint32_t cpflags = GIT_CPDIR_COPY_SYMLINKS | GIT_CPDIR_SIMPLE_TO_MODE | GIT_CPDIR_COPY_DOTFILES; |