2626
2727static const int maxSimultaneousProcesses = 100 ;
2828
29- static const int maxMark = (1 << 20 ) - 1 ; // some versions of git-fast-import are buggy for larger values of maxMark
29+ static const int maxMark = (1 << 20 ) - 2 ; // some versions of git-fast-import are buggy for larger values of maxMark
3030
3131class ProcessCache : QLinkedList<Repository *>
3232{
@@ -271,12 +271,15 @@ void Repository::closeFastImport()
271271
272272void Repository::reloadBranches ()
273273{
274+ bool reset_notes = false ;
274275 foreach (QString branch, branches.keys ()) {
275276 Branch &br = branches[branch];
276277
277278 if (br.marks .isEmpty () || !br.marks .last ())
278279 continue ;
279280
281+ reset_notes = true ;
282+
280283 QByteArray branchRef = branch.toUtf8 ();
281284 if (!branchRef.startsWith (" refs/" ))
282285 branchRef.prepend (" refs/heads/" );
@@ -285,6 +288,13 @@ void Repository::reloadBranches()
285288 " \n from :" + QByteArray::number (br.marks .last ()) + " \n\n "
286289 " progress Branch " + branchRef + " reloaded\n " );
287290 }
291+
292+ if (reset_notes &&
293+ CommandLineParser::instance ()->contains (" add-metadata-notes" )) {
294+ fastImport.write (" reset refs/notes/commits\n from :" +
295+ QByteArray::number (maxMark + 1 ) +
296+ " \n " );
297+ }
288298}
289299
290300int Repository::markFrom (const QString &branchFrom, int branchRevNum, QByteArray &branchFromDesc)
@@ -674,6 +684,7 @@ void Repository::Transaction::commitNote(const QByteArray ¬eText, bool append
674684
675685 QTextStream s (&repository->fastImport );
676686 s << " commit refs/notes/commits" << endl
687+ << " mark :" << QByteArray::number (maxMark + 1 ) << endl
677688 << " committer " << QString::fromUtf8 (author) << ' ' << datetime << " +0000" << endl
678689 << " data " << message.length () << endl
679690 << message << endl
0 commit comments