aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/git/gitgrep.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use QString::size() instead QString::length()hjk2025-11-131-1/+1
| | | | | | | Minor gain in debug builds and when stepping. Change-Id: I2540d309661e4babfd7331b068c17657ded2a098 Reviewed-by: David Schulz <david.schulz@qt.io>
* Git: Persist "Recurse submodules" for searchOrgad Shaneh2025-07-151-0/+3
| | | | | | Change-Id: I31ca0bb0f3164dbee277a7b2fa8ffe5ab3249ab4 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de>
* GitClient: Get rid of gitVersion()Jarek Kobus2025-01-241-7/+3
| | | | | | | | We assume the minimum required version is 2.13. Change-Id: I8ed8b199700243182d1b55b936631865fe7e462e Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: André Hartmann <aha_1980@gmx.de>
* GitGrep: Remove unused fieldJarek Kobus2024-07-171-1/+0
| | | | | Change-Id: I362f84401ce0bd64a39fc32e5877b9f642c0f616 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* FindFilter: Move settings saving to StoreEike Ziller2024-06-031-4/+5
| | | | | | | | This makes it possible to save it for the session instead/in addition. Task-number: QTCREATORBUG-793 Change-Id: I95bc20f4912a97863cb88849e32699a689ba6f3f Reviewed-by: David Schulz <david.schulz@qt.io>
* Utils: Fix build with MSVC with C++20Eike Ziller2024-02-281-1/+1
| | | | | | | | | | | | | | | | | Rename process.h back to qtcprocess.h MSVC's "threads" standard header includes <process.h>, and that ends up including our process.h from Utils. There already was a hacky workaround in place for a similar issue with MINGW, but that doesn't work with MSVC because that doesn't have Simply use a name that doesn't conflict. Change-Id: I1159cd2096b4f2dbc4a1728d0131dd6edd30ebd3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
* VCS: Allow remote vcs operationsMarcus Tillmanns2024-02-121-2/+2
| | | | | | | | | | | | | | | | Both VcsBaseClient::vcsBinary() and VcsBaseClient::processEnvironment() get an additional parameter "FilePath target" to allow selecting binaries and environment based on where the repository is located. This allows to select e.g. a git binary on a remote device, and the environment of the remote device for each VCS operation. A bunch of file path operations are either fixed or ported to actually use FilePath correctly. Change-Id: I6afc645772fde3dff3ec19c13efe538e5888e952 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Git: Use QVersionNumber for git versionJarek Kobus2024-01-201-2/+2
| | | | | | | | | Parse the version string with base 10 now. Amends abee98b44817d1aee63b5cd9b673d0c3aa1733ba Change-Id: I2f0b47380a9714b3f3de475ddabe78875db3b608 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* All: Remove some unneeded #includeshjk2023-09-271-1/+0
| | | | | Change-Id: If9a8fb5e0b32424e3b37ecf3adefc060f86b3630 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* Utils, all: Standardize on QtcSettingshjk2023-09-271-2/+2
| | | | | Change-Id: Id222016f15b1c3bfe6710fe5d0297666d4565ef1 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* Git: Initialize GitClient on first accesshjk2023-07-261-5/+5
| | | | | | | | | | | | | | | | This does not change the current timing of construction a lot as the GerritPlugin may need it immediately in some cases, in any case the gitGrep instance will need it. There's nothing big going on at destruction time, so the prolonged lifetime until really close to the end does not hurt. The reason here is that this way we will avoid cases like in change 5e5b90a9a1664c. Change-Id: I326d83c1a3d21114322ac6cce8d9e9b782faacdc Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Fix some warnings about unused thingsEike Ziller2023-07-251-1/+0
| | | | | | Change-Id: I42bb514dfe1d6745b1469b508a4cfa576e17c31b Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* BaseFileFind: Some cleanup, also in derived classesJarek Kobus2023-07-071-1/+1
| | | | | | Change-Id: I1fb3d3937543f9c4fd8ca723410494cfc76322ee Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* BaseFileFind: Make searchDir() non-virtualJarek Kobus2023-07-061-1/+1
| | | | | | | | | | Replace FindInFiles::pathChanged() with BaseFileFind::searchDirChanged(). Change-Id: I3cbe507968391fe45f513490424a7fe6fbbffee1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* BaseFileFind: Replace additionalParameters() with searchDir()Jarek Kobus2023-07-061-9/+6
| | | | | | | | | | | | | | | | | | | | The FileFindParameters::additionalParameters, holding QVariant, was ambiguous. Since GitGrep and SilverSearcher need a search directory input unconditionally, replace the additionalParameters field with searchDir of FilePath type. For Internal search engine, this field isn't used - the searchDir is already passed in FindInFiles::fileContainerProvider() with lambda capture; for other BaseFileFind subclasses, not combined with non-Internal search engine, the field isn't used anyway. This change closes the chain of patches to eliminate the usage of ambiguous QVariant type inside FileFindParameters. Change-Id: Icddd1cfe46e86ea892221862d9d267f9c9fa173c Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* FileFindParameters: Get rid of searchEngineParameters fieldJarek Kobus2023-07-061-12/+4
| | | | | | | | | | | Get rid of ambiguous searchEngineParameters QVariant. Pass the custom parameters through the lambda captures of the SearchEngine::searchExecutor() overloads. Change-Id: I971a3871199a17200ec662392dfd7095a7a56a50 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* SearchEngine: Replace executeSearch() with searchExecutor()Jarek Kobus2023-07-061-2/+4
| | | | | | Change-Id: Icce615d0cedef35ff4278f9ecfffa415b1aa0386 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* GitGrep: Pass GitGrepParameters through the lambda captureJarek Kobus2023-07-041-8/+8
| | | | | | | | | Instead of using QVariant searchEngineParameters. Change-Id: I30b2bf06fb16586b11e22410e1662d3127ae97be Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* SearchEngine: Replace openEditor() with editorOpener()Jarek Kobus2023-07-041-13/+15
| | | | | | | Change-Id: I45da343f4df3cf634c24bbb518703c856fbb4d90 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* BaseFileFind: Replace files() with fileContainerProvider()Jarek Kobus2023-07-041-2/+1
| | | | | | | | | | | | | | | | | | | | | | | The fileContainerProvider() is called only once per SearchResult instance, and the result (the provider) is stored inside FileFindParameters. In this way the extra data, like the name filters or the search directory, are set just once. Whenever the search is started (or started again), the stored provider recreates the FileContainer according to the data that has been captured by the lambda when the provider was created. This patch eliminates the need for retrieving the custom data from QVariant. It also eliminates the set of arbitrary arguments for the removed files() method. Remove the BaseFileFind * argument from the SearchEngine::executeSearch() method. Change-Id: I7211f503f82db12b5a99c9d342466daaaae0839f Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* GitGrep: Reuse searchInProcessOutput()Jarek Kobus2023-06-021-182/+112
| | | | | | | Change-Id: I5e97f23c0e2a06ccd3d204977ac1abc986b84e5c Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* GitGrep: Make pause and continue workingJarek Kobus2023-06-021-17/+58
| | | | | | | | | | | | Make cancel and continue button working. Make pausing above 200000 hits working. Applied the same pattern as it was done recently inside SilverSearcher: cd70d10dce8993d9923619aa4582b5c84a46b12e. Change-Id: I5e466e2176a59301dbfd3f957012e1760bd0c20f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* GitGrep: Use QStringView for parsingJarek Kobus2023-06-011-27/+48
| | | | | | | | | | | | This speeds up the parsing of big results (~2 million hits) by ~5-10%. Remove PromiseType alias. Make regexp a member field and configure it just once inside c'tor. Change-Id: Ib99597a7b8b979d49f36f2c7d146beeaa1caa380 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* GitGrep: Use the text editor font for the resultsJarek Kobus2023-06-011-0/+1
| | | | | | | This looks more consistent with the results reported by the internal engine. Change-Id: I7a83954d230a61bb6db380d28de32ebde95ad366 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* FileSearch: Get rid of FileSearchResultJarek Kobus2023-05-091-13/+12
| | | | | | | | | Use SearchResultItem instead. This change should reduce the remaining freeze described in a9eb732ce6763e22badd92fc8523cebe84b09a84 even more. Change-Id: I102b82ed5677360ccd9e425dd0bdd941d87116f0 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Rename qtcprocess.{cpp,h} -> process.{cpp,h}Jarek Kobus2023-05-041-1/+1
| | | | | | | | Follows QtcProcess -> Process rename. Change-Id: I97235a9a40cb7fd52944515b7ab878d96528f919 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Utils: Rename QtcProcess -> ProcessJarek Kobus2023-05-041-1/+1
| | | | | | | | Task-number: QTCREATORBUG-29102 Change-Id: Ibc264f9db6a32206e4097766ee3f7d0b35225a5c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
* Utils: Rename asynctask.{cpp,h} -> async.{cpp,h}Jarek Kobus2023-05-031-1/+1
| | | | | | | Follows AsyncTask -> Async rename. Change-Id: I37f18368ab826c9960a24087b52f6691bb33f225 Reviewed-by: hjk <hjk@qt.io>
* RunExtensions: Move onResultReady and onFinished into asynctask.hJarek Kobus2023-04-171-1/+0
| | | | | | | Change-Id: I96dbf5b0253251224ae678172cd5fca12b34326a Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* VcsBase: Use QtConcurrent invocation for async runJarek Kobus2023-03-091-7/+8
| | | | | | | Change-Id: Ia4e461c1a2e71d4c959f582e9ed464d4713b672a Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* VcsBase: Proliferate use of FilePathhjk2023-01-201-1/+1
| | | | | | | ... and update user code. Change-Id: I52c08e9e07238536d31fc72f97312ac582a1e32f Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Remove GPL-3.0+ from license identifiersKai Köhne2023-01-061-1/+1
| | | | | | | | | | | | | | | Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0, this applies only to a hypothetical newer version of GPL, that doesn't exist yet. If such a version emerges, we can still decide to relicense... While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only Change was done by running find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \; Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Don't call non-const methods on temporary QListJarek Kobus2022-12-081-5/+6
| | | | | | | | Otherwise it may unnecessarily detach. Either store a local const reference or call const equivalent (e.g. constFirst()). Change-Id: I96d665487cf28c17e72bea17f1b8f164ce06cc70 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-071-1/+1
| | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I88edd91395849574436299b8badda21bb93bea39 Reviewed-by: hjk <hjk@qt.io>
* Git: Convert to Tr::trAlessandro Portale2022-10-061-19/+15
| | | | | Change-Id: I7fb1753109a9263c70c01713f5f4895db6b73662 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* VcsBasePlugin: Use more FilePathJarek Kobus2022-10-041-1/+1
| | | | | | Change-Id: I7bc80245b093b210439efdf3ea353b52b288dcc0 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* GitGrep: Use QtcProcess instead of VcsCommandJarek Kobus2022-09-061-25/+15
| | | | | | | | | | Originally VcsCommand was created in main thread, while VcsCommand::runCommand() has been called in worker thread. Fix it by using QtcProcess directly in worker thread. Change-Id: I65f3476c0b89466c4347b0469e4cbad89c09072d Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* FileSearchResult: Use FilePath for fileNameJarek Kobus2022-09-061-1/+1
| | | | | | | | | | | This saves about 2 seconds out of 5 seconds spent in displayResult() for converting from QString into FilePath in main thread (use case: gitgrep with 2 million hits). Change-Id: I6334e8559986501c34c90a5c7c6b4acc9a6953e0 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
* GitGrep: Don't pass SuppressFailMessage with SilentOutputJarek Kobus2022-09-051-1/+1
| | | | | | | SilentOutput defines SuppressFailMessage already. Change-Id: I80761ed2041f809968890464573863c47b3fac84 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Use SPDX license identifiersLucie Gérard2022-08-261-24/+2
| | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Task-number: QTBUG-67283 Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* VcsCommand: Simplify public runCommand()Jarek Kobus2022-08-021-1/+1
| | | | | | | | | Get rid of unused workingDirectory (default working directory will be used) and exitCodeInterpreter. Simplify internals a bit. Change-Id: I2a7547e5a594dd7a21f390daeb06778656e9e971 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Move ShellCommand into VcsBase pluginJarek Kobus2022-08-011-5/+8
| | | | | | | | | | Rename it to VcsCommand. Move also ShellCommandPage into VcsBase plugin. Change-Id: I335ac47e3090f2be497643ebcda0eaad2987ac81 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* ShellCommand: Introduce CommandResult structureJarek Kobus2022-07-291-5/+3
| | | | | | | | | Don't require QtcProcess instance when calling ShellCommand::runCommand(). Change-Id: Ie0287d91c1807465eab12be7eaa2eac561179af7 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* VcsBase: Hide VcsCommand classJarek Kobus2022-07-131-1/+1
| | | | | | | | | | | | Make it an implementation detail. Introduce VcsBaseClient::createVcsCommand() method instead for instantiating VcsCommands. Replace all occuriences of VcsBase::VcsCommand in public API with Utils::ShellCommand. Change-Id: Ie438cc3a5e867b3ee8f9e935b56b2f16ea453f8a Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* ShellCommand: Merge VcsCommand::VcsRunFlags into RunFlagsJarek Kobus2022-07-121-6/+4
| | | | | | | Use ShellCommand class name in signal-slot connections. Change-Id: Id50ee6887708558a2ba0972ece6c420b0be36f72 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Git: Do not run 'git --version' synchronously at startupEike Ziller2022-06-291-4/+9
| | | | | | | | | | | We can easily delay this, and if git acts up for some reason, we don't have to block startup. Task-number: QTCREATORBUG-27765 Change-Id: I25aa6f8d04d1fd4b9d87f8ccf7ffd591f7bbe519 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* QtcProcess: Limit the inclusion of qtcprocess.hJarek Kobus2022-03-021-5/+5
| | | | | | | | | | Move the rest of QtcProcess enums to processenums.h. Move ExitCodeInterpreter into processenums.h. Remove superfluous Utils:: prefix. Change-Id: Iaa596f353d33d6930085a621b114cc15a35caa80 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Git: Adapt grep to new default coloring in Git 2.35Orgad Shaneh2022-01-261-0/+2
| | | | | | Change-Id: Id830d3341974f70e4ce6b419152d3558bba2a95f Reviewed-by: hjk <hjk@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de>
* Various FilePath::fromString -> fromUserInput changesAlessandro Portale2021-09-231-2/+2
| | | | | Change-Id: Ic9c5e2f5c0375468651557f504b101572b72ac06 Reviewed-by: hjk <hjk@qt.io>
* Vcs: Use more FilePath for file pathshjk2021-08-021-6/+6
| | | | | Change-Id: I855cde65d034a9647972a7fddf1e8266d7ccfa88 Reviewed-by: Orgad Shaneh <orgads@gmail.com>