diff options
-rw-r--r-- | src/repository.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/repository.cpp b/src/repository.cpp index 25215ae..abd037a 100644 --- a/src/repository.cpp +++ b/src/repository.cpp @@ -26,7 +26,7 @@ static const int maxSimultaneousProcesses = 100; -static const int maxMark = (1 << 20) - 1; // some versions of git-fast-import are buggy for larger values of maxMark +static const int maxMark = (1 << 20) - 2; // some versions of git-fast-import are buggy for larger values of maxMark class ProcessCache: QLinkedList<Repository *> { @@ -271,12 +271,15 @@ void Repository::closeFastImport() void Repository::reloadBranches() { + bool reset_notes = false; foreach (QString branch, branches.keys()) { Branch &br = branches[branch]; if (br.marks.isEmpty() || !br.marks.last()) continue; + reset_notes = true; + QByteArray branchRef = branch.toUtf8(); if (!branchRef.startsWith("refs/")) branchRef.prepend("refs/heads/"); @@ -285,6 +288,13 @@ void Repository::reloadBranches() "\nfrom :" + QByteArray::number(br.marks.last()) + "\n\n" "progress Branch " + branchRef + " reloaded\n"); } + + if (reset_notes && + CommandLineParser::instance()->contains("add-metadata-notes")) { + fastImport.write("reset refs/notes/commits\nfrom :" + + QByteArray::number(maxMark + 1) + + "\n"); + } } int Repository::markFrom(const QString &branchFrom, int branchRevNum, QByteArray &branchFromDesc) @@ -674,6 +684,7 @@ void Repository::Transaction::commitNote(const QByteArray ¬eText, bool append QTextStream s(&repository->fastImport); s << "commit refs/notes/commits" << endl + << "mark :" << QByteArray::number(maxMark + 1) << endl << "committer " << QString::fromUtf8(author) << ' ' << datetime << " +0000" << endl << "data " << message.length() << endl << message << endl |