From 99b941915069731c608f8af6c0bc2e6b026c6fa5 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Tue, 22 Aug 2023 12:19:25 +0200 Subject: [PATCH] Made gitBlob() static and execute in /tmp as this command can be executed for every file not only the files contained in a git repository. --- git/git_client.cpp | 2 +- git/git_client.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/git/git_client.cpp b/git/git_client.cpp index 35475f2..f3c4ae1 100644 --- a/git/git_client.cpp +++ b/git/git_client.cpp @@ -330,7 +330,7 @@ QString GitClient::gitBlob(QString fileName) { if (fi.exists()) { QString const gitCommand = QString("git hash-object %1").arg(fileName); Command c(gitCommand); - if (c.execute(m_workingDirectory)) { + if (c.execute("/tmp")) { return c.getCommandResult().trimmed(); } } diff --git a/git/git_client.h b/git/git_client.h index 0faca95..63d83e4 100644 --- a/git/git_client.h +++ b/git/git_client.h @@ -51,7 +51,7 @@ class GitClient : public QObject { QString gitLastCommit(QString fileName); QStringList gitShowReason(); - QString gitBlob(QString fileName); + static QString gitBlob(QString fileName); QString gitCommitForBlob(QString blob); bool gitIsFileTracked(QString file2name); };