diff --git a/plugins/Git/jobs/clonejob.cpp b/plugins/Git/jobs/clonejob.cpp index 219f322..70cf6d3 100644 --- a/plugins/Git/jobs/clonejob.cpp +++ b/plugins/Git/jobs/clonejob.cpp @@ -22,13 +22,13 @@ CloneJob::CloneJob(QString url, QString path, cred_type cred): void CloneJob::run() { auto tmp_dir = this->cloneSetup(); - auto err = this->clone(this->m_url, tmp_dir.absolutePath(), this->m_cred, this->credentialsCB); - if (!err) { + auto ret = this->clone(this->m_url, tmp_dir.absolutePath(), this->m_cred, this->credentialsCB); + if (ret) { this->moveToDestination(tmp_dir, this->m_path); } - this->cloneTearDown(tmp_dir); + this->cloneCleanUp(tmp_dir); - emit resultReady(err); // TODO Clean error handling to return specifics errors for the ui + emit resultReady(!ret); // TODO Clean error handling to return specifics errors for the ui } @@ -37,26 +37,26 @@ QDir CloneJob::cloneSetup() QDir tmp_dir(QStandardPaths::writableLocation( QStandardPaths::CacheLocation).append("/clone")); tmp_dir.removeRecursively(); - qDebug() << "Temp dir path is " << tmp_dir.absolutePath(); + qDebug() << "[CloneJob]Temp dir path is " << tmp_dir.absolutePath(); return tmp_dir; } -bool CloneJob::cloneTearDown(QDir tmp_dir) +bool CloneJob::cloneCleanUp(QDir tmp_dir) { return tmp_dir.removeRecursively(); } bool CloneJob::moveToDestination(QDir tmp_dir, QString path) { - qDebug() << "Removing password_store " << path; + qDebug() << "[CloneJob] Removing password_store " << path; QDir destination_dir(path); destination_dir.removeRecursively(); - qDebug() << "Moving cloned content to destination dir"; + qDebug() << "[CloneJob] Moving cloned content to destination dir"; QDir dir; - qDebug() << tmp_dir.absolutePath() << " to " << destination_dir.absolutePath(); + qDebug() << "[CloneJob]" << tmp_dir.absolutePath() << " to " << destination_dir.absolutePath(); return dir.rename(tmp_dir.absolutePath(), destination_dir.absolutePath()); // TODO Better error handling } @@ -69,12 +69,17 @@ bool CloneJob::clone(QString url, QString path, cred_type cred, git_cred_acquire opts.fetch_opts.callbacks.payload = &cred; int ret = git_clone(&repo, url.toLocal8Bit().data(), path.toLocal8Bit().data(), &opts); - if (ret != 0) { - qDebug() << git_error_last()->message; + if (ret == GIT_EUSER ) { + qDebug() << "[CloneJob] CallBack Error"; + } else if (ret != 0) { + auto err = git_error_last(); // TODO Better error handling for return ui messages + if (err) { + qDebug() << "[CloneJob]" << git_error_last()->message; + } } if (repo) { git_repository_free(repo); - }// TODO Better error handling - return ret != 0; + } + return ret == 0; } diff --git a/plugins/Git/jobs/clonejob.h b/plugins/Git/jobs/clonejob.h index 5fee646..69dc62c 100644 --- a/plugins/Git/jobs/clonejob.h +++ b/plugins/Git/jobs/clonejob.h @@ -70,7 +70,7 @@ private: * @param tmp_dir The temporary directory to tear down. * @return `true` if the teardown was successful, `false` otherwise. */ - static bool cloneTearDown(QDir tmp_dir); + static bool cloneCleanUp(QDir tmp_dir); /** * @brief Clones a repository from a specified URL. diff --git a/plugins/Git/jobs/gitjob.cpp b/plugins/Git/jobs/gitjob.cpp index 7b6bd4b..53536e8 100644 --- a/plugins/Git/jobs/gitjob.cpp +++ b/plugins/Git/jobs/gitjob.cpp @@ -25,27 +25,27 @@ int GitJob::credentialsCB(git_cred **out, const char *url, const char *username_ auto v = overload { [](const HTTP & x) { - qDebug() << "credentialsCB : HTTP "; - qWarning() << "credentialsCB : callback should never be call for HTTP "; + qDebug() << "[GitJob] credentialsCB : HTTP "; + qWarning() << "[GitJob] credentialsCB : callback should never be call for HTTP "; return (int) GIT_EUSER; }, [&out, &username_from_url](const HTTPUserPass & x) { - qDebug() << "credentialsCB : HTTPUserPass "; + qDebug() << "[GitJob] credentialsCB : HTTPUserPass "; if (!username_from_url) { - qWarning() << "credentials_cb : no username provided "; + qWarning() << "[GitJob] credentials_cb : no username provided "; return (int) GIT_EUSER; } return git_cred_userpass_plaintext_new(out, username_from_url, x.pass.toLocal8Bit().constData()); }, [](const SSHPass & x) { - qWarning() << "credentials_cb : SSHAuth to be implemented "; + qWarning() << "[GitJob] credentials_cb : SSHAuth to be implemented "; return (int) GIT_EUSER; }, // TODO [](const SSHKey & x) { - qWarning() << "credentials_cb : SSHKey to be implemented "; + qWarning() << "[GitJob] credentials_cb : SSHKey to be implemented "; return (int) GIT_EUSER; } // TODO }; diff --git a/po/utpass.qrouland.pot b/po/utpass.qrouland.pot index 5d93caf..b52dbba 100644 --- a/po/utpass.qrouland.pot +++ b/po/utpass.qrouland.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: utpass.qrouland\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-03 21:35+0100\n" +"POT-Creation-Date: 2025-02-04 14:05+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -122,8 +122,8 @@ msgid "You're are about to delete
the current Password Store.
Continue ?" msgstr "" #: ../qml/pages/settings/DeleteRepo.qml:56 -#: ../qml/pages/settings/ImportZip.qml:64 -#: ../qml/pages/settings/InfoKeys.qml:170 +#: ../qml/pages/settings/ImportZip.qml:66 +#: ../qml/pages/settings/InfoKeys.qml:174 #: ../qml/pages/settings/git/ImportGitClone.qml:56 msgid "Yes" msgstr "" @@ -137,37 +137,37 @@ msgid "Password Store deleted !" msgstr "" #: ../qml/pages/settings/DeleteRepo.qml:90 -#: ../qml/pages/settings/InfoKeys.qml:212 +#: ../qml/pages/settings/InfoKeys.qml:216 msgid "Info Keys" msgstr "" -#: ../qml/pages/settings/ImportKeyFile.qml:59 +#: ../qml/pages/settings/ImportKeyFile.qml:61 msgid "Key import failed !" msgstr "" -#: ../qml/pages/settings/ImportKeyFile.qml:68 +#: ../qml/pages/settings/ImportKeyFile.qml:70 msgid "Key successfully imported !" msgstr "" -#: ../qml/pages/settings/ImportKeyFile.qml:79 +#: ../qml/pages/settings/ImportKeyFile.qml:81 msgid "GPG Key Import" msgstr "" -#: ../qml/pages/settings/ImportZip.qml:63 +#: ../qml/pages/settings/ImportZip.qml:65 msgid "" "Importing a new zip will delete
any existing password store!
Continue ?" msgstr "" -#: ../qml/pages/settings/ImportZip.qml:77 +#: ../qml/pages/settings/ImportZip.qml:79 msgid "Password store import failed !" msgstr "" -#: ../qml/pages/settings/ImportZip.qml:86 +#: ../qml/pages/settings/ImportZip.qml:88 #: ../qml/pages/settings/git/ImportGitClone.qml:78 msgid "Password store sucessfully imported !" msgstr "" -#: ../qml/pages/settings/ImportZip.qml:98 +#: ../qml/pages/settings/ImportZip.qml:100 msgid "Zip Password Store Import" msgstr "" @@ -179,27 +179,27 @@ msgstr "" msgid "Key ID :" msgstr "" -#: ../qml/pages/settings/InfoKeys.qml:120 +#: ../qml/pages/settings/InfoKeys.qml:124 msgid "Users IDs : " msgstr "" -#: ../qml/pages/settings/InfoKeys.qml:147 +#: ../qml/pages/settings/InfoKeys.qml:151 msgid "Delete this key" msgstr "" -#: ../qml/pages/settings/InfoKeys.qml:169 +#: ../qml/pages/settings/InfoKeys.qml:173 msgid "You're are about to delete
%1.
Continue ?" msgstr "" -#: ../qml/pages/settings/InfoKeys.qml:183 +#: ../qml/pages/settings/InfoKeys.qml:187 msgid "Key removal failed !" msgstr "" -#: ../qml/pages/settings/InfoKeys.qml:192 +#: ../qml/pages/settings/InfoKeys.qml:196 msgid "Key successfully deleted !" msgstr "" -#: ../qml/pages/settings/InfoKeys.qml:204 +#: ../qml/pages/settings/InfoKeys.qml:208 msgid "An Error occured getting GPG keys !" msgstr ""