| 346 | } |
| 347 | |
| 348 | void GitCache::updateCommit(const QString &oldSha, CommitInfo newCommit) |
| 349 | { |
| 350 | QMutexLocker lock(&mCommitsMutex); |
| 351 | QMutexLocker lock2(&mRevisionsMutex); |
| 352 | |
| 353 | auto &oldCommit = mCommitsMap[oldSha]; |
| 354 | const auto oldCommitParens = oldCommit.parents(); |
| 355 | const auto newCommitSha = newCommit.sha; |
| 356 | |
| 357 | mCommitsMap.remove(oldSha); |
| 358 | mCommitsMap.insert(newCommitSha, std::move(newCommit)); |
| 359 | mCommits[1] = &mCommitsMap[newCommitSha]; |
| 360 | |
| 361 | for (const auto &parent : oldCommitParens) |
| 362 | { |
| 363 | mCommitsMap[parent].removeChild(&oldCommit); |
| 364 | mCommitsMap[parent].appendChild(&mCommitsMap[newCommitSha]); |
| 365 | } |
| 366 | |
| 367 | const auto tags = getReferences(oldSha, References::Type::LocalTag); |
| 368 | for (const auto &tag : tags) |
| 369 | { |
| 370 | insertReference(newCommitSha, References::Type::LocalTag, tag); |
| 371 | deleteReference(oldSha, References::Type::LocalTag, tag); |
| 372 | } |
| 373 | |
| 374 | const auto localBranches = getReferences(oldSha, References::Type::LocalBranch); |
| 375 | for (const auto &branch : localBranches) |
| 376 | { |
| 377 | insertReference(newCommitSha, References::Type::LocalBranch, branch); |
| 378 | deleteReference(oldSha, References::Type::LocalBranch, branch); |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | void GitCache::calculateLanes(CommitInfo &c) |
| 383 | { |
no test coverage detected