| 32 | void Submodule::initialize() const { git_submodule_init(d.data(), false); } |
| 33 | |
| 34 | void Submodule::deinitialize() const { |
| 35 | // Remove git config entry. |
| 36 | Repository repo(git_submodule_owner(d.data())); |
| 37 | Config config = repo.gitConfig(); |
| 38 | QString regex = QString("submodule\\.%1\\..*").arg(name()); |
| 39 | Config::Iterator it = config.glob(regex); |
| 40 | while (Config::Entry entry = it.next()) |
| 41 | config.remove(entry.name()); |
| 42 | |
| 43 | // Remove submodule workdir. |
| 44 | QDir dir = repo.workdir(); |
| 45 | if (dir.cd(path()) && dir.removeRecursively()) |
| 46 | dir.mkpath("."); |
| 47 | } |
| 48 | |
| 49 | QString Submodule::name() const { return git_submodule_name(d.data()); } |
| 50 | |