Commit e32ff1aa authored by Ivanq's avatar Ivanq

Use profile when creating initial commit

parent 7e07411a
......@@ -891,7 +891,7 @@ class Git {
}
};
Git.init = (root, zeroPage) => {
Git.init = (root, zeroPage, name, email) => {
let zeroFS = new ZeroFS(zeroPage);
let git;
......@@ -912,7 +912,7 @@ Git.init = (root, zeroPage) => {
let minutes = Math.abs((tz + 60) % 60);
tz = (tz > 0 ? "+" : "-") + (hours < 10 ? "0" : "") + hours + (minutes < 10 ? "0" : "") + minutes;
let author = "Git Center <[email protected]> " + Math.floor(+date / 1000) + " " + tz;
let author = name + " <" + email + "> " + Math.floor(+date / 1000) + " " + tz;
return git.writeCommit({
tree: [],
......
......@@ -120,14 +120,16 @@ class Repository {
.then(() => this.sign());
}
install(title, description, address) {
let content;
let auth, content;
return this.getContent()
.then(c => {
content = c;
return this.zeroAuth.requestAuth();
})
.then(auth => {
.then(a => {
auth = a;
content.title = title;
content.description = description;
content.signers = [auth.address];
......@@ -136,7 +138,15 @@ class Repository {
return this.setContent(content);
})
.then(() => {
return Git.init("merged-GitCenter/" + this.address + "/" + address + (address.endsWith(".git") ? "" : ".git"), this.zeroPage);
return this.zeroFS.readFile("data/users/" + auth.address + "/data.json");
})
.then(profile => {
profile = JSON.parse(profile);
profile.commitName = profile.commitName || auth.user[0].toUpperCase() + auth.user.substr(1).replace(/@.*/, "");
profile.commitEmail = profile.commitEmail || auth.user;
return Git.init("merged-GitCenter/" + this.address + "/" + address + (address.endsWith(".git") ? "" : ".git"), this.zeroPage, profile.commitName, profile.commitEmail);
})
.then(git => {
this.git = git;
......
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