Skip to content

Commit 9a46c77

Browse files
committed
repository: do not initialize templates if dir is an empty string
1 parent 8e912e7 commit 9a46c77

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/repository.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1784,7 +1784,13 @@ static int repo_init_structure(
17841784
default_template = true;
17851785
}
17861786

1787-
if (tdir) {
1787+
/*
1788+
* If tdir was the empty string, treat it like tdir was a path to an
1789+
* empty directory (so, don't do any copying). This is the behavior
1790+
* that git(1) exhibits, although it doesn't seem to be officially
1791+
* documented.
1792+
*/
1793+
if (tdir && git__strcmp(tdir, "") != 0) {
17881794
uint32_t cpflags = GIT_CPDIR_COPY_SYMLINKS |
17891795
GIT_CPDIR_SIMPLE_TO_MODE |
17901796
GIT_CPDIR_COPY_DOTFILES;

0 commit comments

Comments
 (0)