From 8f8d4c770ac4884dc6c7909a342b27b28f23cbd9 Mon Sep 17 00:00:00 2001 From: Daniel Hagerty Date: Sun, 7 Oct 2012 15:26:26 +0200 Subject: Set marks on notes, so fast-load picks up from previous state. This should fix the notes upon successive, incremental conversions. --- src/repository.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 { @@ -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 -- cgit v1.2.1