提交 5da541a1 编写于 作者: J Joao Moreno

use git template from workspace when not absolute

fixes #7830
上级 24939812
......@@ -708,9 +708,13 @@ export class Repository {
// https://github.com/git/git/blob/3a0f269e7c82aa3a87323cb7ae04ac5f129f036b/path.c#L612
const homedir = os.homedir();
const templatePath = result.stdout.trim()
let templatePath = result.stdout.trim()
.replace(/^~([^\/]*)\//, (_, user) => `${ user ? path.join(path.dirname(homedir), user) : homedir }/`);
if (!path.isAbsolute(templatePath)) {
templatePath = path.join(this.repository, templatePath);
}
return pfs.readFile(templatePath, 'utf8').then(null, () => '');
}, () => '');
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册