| 60 | } |
| 61 | |
| 62 | void GitModule::initialiseModule(const IApplicationContext& ctx) |
| 63 | { |
| 64 | // Register commands |
| 65 | registerCommands(); |
| 66 | createPreferencePage(); |
| 67 | |
| 68 | // Initialise libgit2 to have the memory handlers etc. set up |
| 69 | git_libgit2_init(); |
| 70 | |
| 71 | auto modPath = GlobalGameManager().getModPath(); |
| 72 | _repository = std::make_unique<git::Repository>(modPath); |
| 73 | |
| 74 | if (_repository->isOk()) |
| 75 | { |
| 76 | rMessage() << "Opened repository at " << modPath << std::endl; |
| 77 | rMessage() << "Repository is currently on branch " << _repository->getCurrentBranchName() << std::endl; |
| 78 | } |
| 79 | else |
| 80 | { |
| 81 | _repository.reset(); |
| 82 | } |
| 83 | |
| 84 | GlobalMainFrame().signal_MainFrameConstructed().connect([&]() |
| 85 | { |
| 86 | _statusBarWidget = std::make_unique<ui::VcsStatus>(GlobalStatusBarManager().getStatusBar()); |
| 87 | GlobalStatusBarManager().addElement(ui::VcsStatus::Name, _statusBarWidget->getWidget(), |
| 88 | ::ui::statusbar::StandardPosition::MapEditStopwatch + 10); |
| 89 | |
| 90 | _statusBarWidget->setRepository(_repository); |
| 91 | }); |
| 92 | |
| 93 | GlobalVersionControlManager().registerModule(shared_from_this()); |
| 94 | } |
| 95 | |
| 96 | void GitModule::shutdownModule() |
| 97 | { |
nothing calls this directly
no test coverage detected