From daded9dd3fe77b6e56e617fbbe612317c644dc7a Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Tue, 20 Oct 2009 18:12:21 +0200 Subject: Create repos as we go. Instead of failing with an unhelpful error in fast-import we create the repositories we require to import into if they don't exist. --- src/repository.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/repository.cpp b/src/repository.cpp index 182309c..72d681e 100644 --- a/src/repository.cpp +++ b/src/repository.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2007 Thiago Macieira + * Copyright (C) 2009 Thomas Zander * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,6 +20,7 @@ #include "options.h" #include #include +#include #include static const int maxSimultaneousProcesses = 100; @@ -63,6 +65,16 @@ Repository::Repository(const Rules::Repository &rule) branches["master"].created = 1; fastImport.setWorkingDirectory(name); +#ifndef DRY_RUN + if (!QDir(name).exists()) { // repo doesn't exist yet. + qDebug() << "Creating new repositoryn" << name; + QDir::current().mkpath(name); + QProcess init; + init.setWorkingDirectory(name); + init.start("git", QStringList() << "--bare" << "init"); + init.waitForFinished(-1); + } +#endif } Repository::~Repository() -- cgit v1.2.1