@@ -134,6 +134,7 @@ class FastImportRepository : public Repository
134134 QVector<int > marks;
135135 };
136136
137+ QString defaultBranch;
137138 QHash<QString, Branch> branches;
138139 QHash<QString, QByteArray> branchNotes;
139140 QHash<QString, AnnotatedTag> annotatedTags;
@@ -351,15 +352,15 @@ FastImportRepository::FastImportRepository(const Rules::Repository &rule)
351352 QProcess config;
352353 config.start (" git" , QStringList () << " config" << " init.defaultBranch" );
353354 config.waitForFinished (-1 );
354- QString defaultBranch = QString (config.readAllStandardOutput ()).trimmed ();
355+ defaultBranch = QString (config.readAllStandardOutput ()).trimmed ();
355356
356357 // Create the default branch
357358 if (defaultBranch.isEmpty ()) {
358- branches[" master" ].created = 1 ;
359- } else {
360- branches[defaultBranch].created = 1 ;
359+ defaultBranch = " master" ;
361360 }
362361
362+ branches[defaultBranch].created = 1 ;
363+
363364 if (!CommandLineParser::instance ()->contains (" dry-run" ) && !CommandLineParser::instance ()->contains (" create-dump" )) {
364365 fastImport.setWorkingDirectory (name);
365366 if (!QDir (name).exists ()) { // repo doesn't exist yet.
@@ -756,7 +757,7 @@ void FastImportRepository::commit()
756757Repository::Transaction *FastImportRepository::newTransaction (const QString &branch, const QString &svnprefix,
757758 int revnum)
758759{
759- if (!branches. contains (branch)) {
760+ if (!branchExists (branch)) {
760761 qWarning () << " WARN: Transaction:" << branch << " is not a known branch in repository" << name << endl
761762 << " Going to create it automatically" ;
762763 }
@@ -1153,8 +1154,9 @@ int FastImportRepository::Transaction::commit()
11531154 if (br.created && !br.marks .isEmpty () && br.marks .last ()) {
11541155 parentmark = br.marks .last ();
11551156 } else {
1156- if (revnum > 1 ) {
1157- // Any branch at revision 1 isn't going to exist, so lets not alarm the user.
1157+ if (revnum > 1 && branch != repository->defaultBranch ) {
1158+ // Any branch at revision 1 isn't going to exist -> do not alarm the user.
1159+ // Default branch might also not exist yet -> do not alarm the user.
11581160 qWarning () << " WARN: Branch" << branch << " in repository" << repository->name << " doesn't exist at revision"
11591161 << revnum << " -- did you resume from the wrong revision?" ;
11601162 }
0 commit comments