From 0fbe22da392f39e1d144f78ef08b2dbdb882c164 Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Thu, 25 Oct 2007 19:14:56 +0200 Subject: [PATCH] init: find template directory on Windows (msys) The template directory must be searched for using the full Windows path. But internally a Unix path starting with '/' is used. The internal Unix path is now prefixed with git_install_prefix() before accessing the file system Only absolute Unix paths are converted. Relative paths can be used as is. Signed-off-by: Steffen Prohaska --- builtin-init-db.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/builtin-init-db.c b/builtin-init-db.c index 5da2515f85..117fedd586 100644 --- a/builtin-init-db.c +++ b/builtin-init-db.c @@ -145,6 +145,17 @@ static void copy_templates(const char *git_dir, int len, const char *template_di template_dir = prefix_path(exec_path, strlen(exec_path), template_dir); } +#if __MINGW32__ + /* + * If it is an absolute Unix path it is prefixed with + * the git_install_prefix(). + */ + else if (template_dir[0] == '/') { + const char* prefix = git_install_prefix(); + template_dir = prefix_path(prefix, strlen(prefix), + template_dir); + } +#endif } strcpy(template_path, template_dir); template_len = strlen(template_path);