summaryrefslogtreecommitdiff
path: root/src/repository.c
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2011-06-29 14:06:18 +0200
committernulltoken <emeric.fermas@gmail.com>2011-06-29 19:22:24 +0200
commit6ac91dfe52e857814fc197614dea0dbf672bdc0f (patch)
treedee6c1ec6b5d886e4c1504273571fa882db114ea /src/repository.c
parentcfef5fb779ceba60cdd04f323b88373181c0fa8d (diff)
downloadlibgit2-6ac91dfe52e857814fc197614dea0dbf672bdc0f.tar.gz
Hide ".git" directory on Windows upon creation of a non bare repository
Directory which name starts with a dot are hidden on Linux platforms. This patch makes libgit2 behaves similarly on Windows.
Diffstat (limited to 'src/repository.c')
-rw-r--r--src/repository.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/repository.c b/src/repository.c
index 47884c937..e0927c077 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -648,6 +648,15 @@ static int repo_init_structure(repo_init *results)
if (gitfo_mkdir_recurs(git_dir, mode))
return git__throw(GIT_ERROR, "Failed to initialize repository structure. Could not mkdir");
+#ifdef GIT_WIN32
+ /* Hides the ".git" directory */
+ if (!results->is_bare) {
+ error = gitfo_hide_directory__w32(git_dir);
+ if (error < GIT_SUCCESS)
+ return git__rethrow(error, "Failed to initialize repository structure");
+ }
+#endif
+
/* Creates the '/objects/info/' directory */
git__joinpath(temp_path, git_dir, GIT_OBJECTS_INFO_DIR);
error = gitfo_mkdir_recurs(temp_path, mode);