Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/renderer/components/repositoryListView/repositoryItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
v-if="!isGit"
margin-left="auto"
class="t-button__primary-warning"
@click.native="initialize(directoryPath)"
>
Initialize
</t-button>
Expand All @@ -45,6 +46,9 @@ import fileIcon from "../icon/file";
import settingsIcon from "../icon/settings";
import closeModal from "../../mixins/closeModal";

import gitInit from "../../git/init";
import database from "../../../database";

export default {
name: "RepositoryItem",
components: {
Expand Down Expand Up @@ -99,6 +103,19 @@ export default {
}
});
this.closeModal("SwitchRepository");
},
async initialize(path) {
await gitInit({ path });
database.run(`
UPDATE gitRepository
SET isGit = TRUE
WHERE repositoryId = $repositoryId
`, { $repositoryId: this.repositoryId },
(err, data) => {
if (err) console.log(err);
else this.isGit = 1;
}
);
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/mixins/addRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ export default {
$repositoryName: data.name,
$directoryName: data.name,
$source: "local",
$commitFeature: 1,
$remoteFeature: 1,
$commitFeature: data.isGitRepo,
$remoteFeature: data.isGitRepo,
$repositoryId: data.repositoryId
},
(err, data) => {
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/modal/newRepository.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ import TButton from "../components/TButton/TButton";
// mixins
import closeModalMixin from "../mixins/closeModal";
import addRepository from "../mixins/addRepository";
import gitInit from "../git/init";

import git from "simple-git/promise";
const fs = require("fs");

export default {
Expand Down Expand Up @@ -107,8 +107,8 @@ export default {
this.localRepository(repositoryPath);
},
async gitInit(path) {
let initializeRepository = git(path);
await initializeRepository.init();
await gitInit({ path });
this.addRepositoryToDatabase(path);
}
}
};
Expand Down