File indexing completed on 2024-04-28 05:49:27
0001 /* 0002 SPDX-FileCopyrightText: 2010 Christoph Cullmann <cullmann@kde.org> 0003 0004 SPDX-License-Identifier: MIT 0005 */ 0006 0007 #pragma once 0008 0009 #include "kateprivate_export.h" 0010 0011 #include <QProcess> 0012 #include <optional> 0013 #include <utility> 0014 0015 class QIcon; 0016 0017 /** 0018 * small helper function to setup a QProcess based "git" command. 0019 * you pass working directory & arguments 0020 * it will additionally setup stuff like GIT_OPTIONAL_LOCKS=0 0021 * after this, you can just call "start" or "startDetached" for the process. 0022 * 0023 * @param process process to setup for git 0024 * @param workingDirectory working directory to use for process 0025 * @param arguments arguments to pass to git 0026 * @return could set setup the process or did that fail, e.g. because the git executable is not available? 0027 */ 0028 KATE_PRIVATE_EXPORT bool setupGitProcess(QProcess &process, const QString &workingDirectory, const QStringList &arguments); 0029 0030 /** 0031 * helper function to get the git version 0032 * @param workingDirectory working directory to use for process 0033 * @return git major and minor version as pair, -1,-1 if infeasible to determine 0034 */ 0035 KATE_PRIVATE_EXPORT std::pair<int, int> getGitVersion(const QString &workingDir); 0036 0037 /** 0038 * @brief get the git repo base path 0039 * Returned path has a `/` at the end 0040 * @param workingDir the dir where 0041 */ 0042 KATE_PRIVATE_EXPORT std::optional<QString> getRepoBasePath(const QString &workingDir); 0043 0044 /** 0045 * @brief returns the git icon for use in UI 0046 */ 0047 KATE_PRIVATE_EXPORT QIcon gitIcon();