| 163 | } |
| 164 | |
| 165 | inline void tryToFinishMerge(const std::shared_ptr<Repository>& repository) |
| 166 | { |
| 167 | auto mapPath = repository->getRepositoryRelativePath(GlobalMapModule().getMapName()); |
| 168 | |
| 169 | auto index = repository->getIndex(); |
| 170 | |
| 171 | if (index->hasConflicts()) |
| 172 | { |
| 173 | // Remove the conflict state from the map |
| 174 | resolveMapFileConflictUsingOurs(repository); |
| 175 | |
| 176 | // If the index still has conflicts, notify the user |
| 177 | if (index->hasConflicts()) |
| 178 | { |
| 179 | wxutil::Messagebox::Show(_("Conflicts"), |
| 180 | _("There are still unresolved conflicts in the repository.\nPlease use your Git client to resolve them and try again."), |
| 181 | ::ui::IDialog::MessageType::MESSAGE_CONFIRM); |
| 182 | return; |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | auto head = repository->getHead(); |
| 187 | if (!head) throw git::GitException("Cannot resolve repository HEAD"); |
| 188 | |
| 189 | auto upstream = head->getUpstream(); |
| 190 | if (!upstream) throw git::GitException("Cannot resolve upstream ref from HEAD"); |
| 191 | |
| 192 | // We need the commit metadata to be valid |
| 193 | git::CommitMetadata metadata; |
| 194 | |
| 195 | metadata.name = repository->getConfigValue("user.name"); |
| 196 | metadata.email = repository->getConfigValue("user.email"); |
| 197 | metadata.message = "Integrated remote changes from " + upstream->getShorthandName(); |
| 198 | |
| 199 | if (metadata.name.empty() || metadata.email.empty()) |
| 200 | { |
| 201 | metadata = ui::CommitDialog::RunDialog(metadata); |
| 202 | } |
| 203 | |
| 204 | if (metadata.isValid()) |
| 205 | { |
| 206 | repository->createCommit(metadata, upstream); |
| 207 | repository->cleanupState(); |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | inline void performFastForward(const std::shared_ptr<Repository>& repository) |
| 212 | { |
no test coverage detected