Skip to content

Commit 8f8d4c7

Browse files
Daniel Hagertyuqs
authored andcommitted
Set marks on notes, so fast-load picks up from previous state.
This should fix the notes upon successive, incremental conversions.
1 parent c018741 commit 8f8d4c7

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/repository.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
static 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

3131
class ProcessCache: QLinkedList<Repository *>
3232
{
@@ -271,12 +271,15 @@ void Repository::closeFastImport()
271271

272272
void 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
"\nfrom :" + 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\nfrom :" +
295+
QByteArray::number(maxMark + 1) +
296+
"\n");
297+
}
288298
}
289299

290300
int Repository::markFrom(const QString &branchFrom, int branchRevNum, QByteArray &branchFromDesc)
@@ -674,6 +684,7 @@ void Repository::Transaction::commitNote(const QByteArray &noteText, 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

Comments
 (0)