MCPcopy Create free account
hub / github.com/KDE/kdevelop / isValidRemoteRepositoryUrl

Method isValidRemoteRepositoryUrl

plugins/git/gitplugin.cpp:324–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

322}
323
324bool GitPlugin::isValidRemoteRepositoryUrl(const QUrl& remoteLocation)
325{
326 if (remoteLocation.isLocalFile()) {
327 QFileInfo fileInfo(remoteLocation.toLocalFile());
328 if (fileInfo.isDir()) {
329 QDir dir(fileInfo.filePath());
330 if (dir.exists(QStringLiteral(".git/HEAD"))) {
331 return true;
332 }
333 // TODO: check also for bare repo
334 }
335 } else {
336 const QString scheme = remoteLocation.scheme();
337 if (scheme == QLatin1String("git") || scheme == QLatin1String("git+ssh")) {
338 return true;
339 }
340 // heuristic check, anything better we can do here without talking to server?
341 if ((scheme == QLatin1String("http") ||
342 scheme == QLatin1String("https")) &&
343 remoteLocation.path().endsWith(QLatin1String(".git"))) {
344 return true;
345 }
346 }
347 return false;
348}
349
350bool GitPlugin::isVersionControlled(const QUrl &path)
351{

Callers 1

fetchProjectFromUrlMethod · 0.45

Calls 6

isLocalFileMethod · 0.80
toLocalFileMethod · 0.80
existsMethod · 0.80
endsWithMethod · 0.80
filePathMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected