repository: do not copy templates if dir nonexistent

This mimics the behaviour of git which just prints a
warning and continues with the repo initialisation.
parent 358a60e1
...@@ -2032,9 +2032,15 @@ static int repo_init_structure( ...@@ -2032,9 +2032,15 @@ static int repo_init_structure(
git_str_dispose(&template_buf); git_str_dispose(&template_buf);
git_config_free(cfg); git_config_free(cfg);
/* If tdir does not exist, then do not error out. This matches the
* behaviour of git(1), which just prints a warning and continues.
* TODO: issue warning when warning API is available.
* `git` prints to stderr: 'warning: templates not found in /path/to/tdir'
*/
if (error < 0) { if (error < 0) {
if (!default_template) if (!default_template && error != GIT_ENOTFOUND) {
return error; return error;
}
/* if template was default, ignore error and use internal */ /* if template was default, ignore error and use internal */
git_error_clear(); git_error_clear();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment