Skip to content

Commit 4d4456f

Browse files
committed
Use fastimport.write for the actual commit objects too, so we get
logging when --debug-rules is turned on.
1 parent bd5e2c4 commit 4d4456f

File tree

1 file changed

+20
-23
lines changed

1 file changed

+20
-23
lines changed

src/repository.cpp

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -682,15 +682,16 @@ void Repository::Transaction::commitNote(const QByteArray &noteText, bool append
682682
message = "Appending Git note for current " + commitRef + "\n";
683683
}
684684

685-
QTextStream s(&repository->fastImport);
686-
s << "commit refs/notes/commits" << endl
687-
<< "mark :" << QByteArray::number(maxMark + 1) << endl
688-
<< "committer " << QString::fromUtf8(author) << ' ' << datetime << " +0000" << endl
689-
<< "data " << message.length() << endl
690-
<< message << endl
691-
<< "N inline " << commitRef << endl
692-
<< "data " << text.length() << endl
693-
<< text << endl;
685+
QByteArray s("");
686+
s.append("commit refs/notes/commits\n");
687+
s.append("mark :" + QByteArray::number(maxMark + 1) + "\n");
688+
s.append("committer " + QString::fromUtf8(author) + " " + QString::number(datetime) + " +0000" + "\n");
689+
s.append("data " + QString::number(message.length()) + "\n");
690+
s.append(message + "\n");
691+
s.append("N inline " + commitRef + "\n");
692+
s.append("data " + QString::number(text.length()) + "\n");
693+
s.append(text + "\n");
694+
repository->fastImport.write(s);
694695

695696
if (commit.isNull()) {
696697
repository->setBranchNote(QString::fromUtf8(branch), text);
@@ -728,21 +729,17 @@ void Repository::Transaction::commit()
728729
br.commits.append(revnum);
729730
br.marks.append(mark);
730731

731-
{
732-
QByteArray branchRef = branch;
733-
if (!branchRef.startsWith("refs/"))
734-
branchRef.prepend("refs/heads/");
735-
QTextStream s(&repository->fastImport);
736-
s.setCodec("UTF-8");
737-
s << "commit " << branchRef << endl;
738-
s << "mark :" << QByteArray::number(mark) << endl;
739-
s << "committer " << QString::fromUtf8(author) << ' ' << datetime << " +0000" << endl;
740-
741-
s << "data " << message.length() << endl;
742-
}
732+
QByteArray branchRef = branch;
733+
if (!branchRef.startsWith("refs/"))
734+
branchRef.prepend("refs/heads/");
743735

744-
repository->fastImport.write(message);
745-
repository->fastImport.putChar('\n');
736+
QByteArray s("");
737+
s.append("commit " + branchRef + "\n");
738+
s.append("mark :" + QByteArray::number(mark) + "\n");
739+
s.append("committer " + QString::fromUtf8(author) + " " + QString::number(datetime) + " +0000" + "\n");
740+
s.append("data " + QString::number(message.length()) + "\n");
741+
s.append(message + "\n");
742+
repository->fastImport.write(s);
746743

747744
// note some of the inferred merges
748745
QByteArray desc = "";

0 commit comments

Comments
 (0)