From 9bfdb4886c29a5cefb6b6d9397d4fd5c5a10fe65 Mon Sep 17 00:00:00 2001 From: soramimi Date: Fri, 30 Aug 2024 23:58:41 +0900 Subject: [PATCH] Refactor internalAfterFetch to use onUpdateCommitLog --- cmake/modules/Findzlib.cmake | 30 ------------------------------ src/MainWindow.cpp | 12 +++++------- src/MainWindow.h | 2 +- src/SubmoduleMainWindow.cpp | 2 +- 4 files changed, 7 insertions(+), 39 deletions(-) delete mode 100644 cmake/modules/Findzlib.cmake diff --git a/cmake/modules/Findzlib.cmake b/cmake/modules/Findzlib.cmake deleted file mode 100644 index 7773469b..00000000 --- a/cmake/modules/Findzlib.cmake +++ /dev/null @@ -1,30 +0,0 @@ -set(zlib_ROOT_DIR "${zlib_DIR}") - -find_path(zlib_INCLUDE_DIRS - NAMES zlib.h - HINTS "${zlib_ROOT_DIR}/include" - DOC "The zlib include directory" - ) - -find_library(zlib_LIBRARIES - NAMES z - HINTS "${zlib_ROOT_DIR}/lib" - DOC "The zlib library" - ) - -include(FindPackageHandleStandardArgs) - -find_package_handle_standard_args(zlib DEFAULT_MSG - zlib_LIBRARIES - zlib_INCLUDE_DIRS - ) - -mark_as_advanced(zlib_INCLUDE_DIRS zlib_LIBRARIES ) - -if(zlib_FOUND) - add_library(zlib SHARED IMPORTED) - set_target_properties(zlib PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${zlib_INCLUDE_DIRS}" - ) - set_property(TARGET zlib APPEND PROPERTY IMPORTED_LOCATION "${zlib_LIBRARIES}") -endif() diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index f6c6ff7a..11ac1964 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -1801,10 +1801,8 @@ void MainWindow::internalAfterFetch() { ASSERT_MAIN_THREAD(); - GitPtr g = git(); - detectGitServerType(g); - queryCommitLog(frame(), g); - updateRemoteInfo(g); + detectGitServerType(git()); + onUpdateCommitLog(); } #define RUN_PTY_CALLBACK [this](ProcessStatus const &status, QVariant const &userdata) @@ -1993,7 +1991,7 @@ void MainWindow::setupUpdateCommitLog() void MainWindow::onUpdateCommitLog() { - openRepositoryMain(frame(), git(), false, false, false, true); + openRepositoryMain(frame(), git(), false, false, true); } void MainWindow::updateCommitLog() @@ -4303,7 +4301,7 @@ Git::Object MainWindow::catFile(QString const &id) void MainWindow::internalOpenRepository(GitPtr g, bool fetch, bool keep_selection) { - openRepositoryMain(frame(), g, true, true, fetch, keep_selection); + openRepositoryMain(frame(), g, true, fetch, keep_selection); } void MainWindow::makeCommitLog(RepositoryWrapperFrame *frame, int scroll_pos, int select_row) @@ -4420,7 +4418,7 @@ void MainWindow::updateHEAD(GitPtr g) setHeadId(head); } -void MainWindow::openRepositoryMain(RepositoryWrapperFrame *frame, GitPtr g, bool query, bool clear_log, bool do_fetch, bool keep_selection) +void MainWindow::openRepositoryMain(RepositoryWrapperFrame *frame, GitPtr g, bool clear_log, bool do_fetch, bool keep_selection) { ASSERT_MAIN_THREAD(); diff --git a/src/MainWindow.h b/src/MainWindow.h index cc91076b..e7f0d8b1 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -158,7 +158,7 @@ class MainWindow : public QMainWindow { void internalOpenRepository(GitPtr g, bool fetch, bool keep_selection); - void openRepositoryMain(RepositoryWrapperFrame *frame, GitPtr g, bool query, bool clear_log, bool do_fetch, bool keep_selection); + void openRepositoryMain(RepositoryWrapperFrame *frame, GitPtr g, bool clear_log, bool do_fetch, bool keep_selection); QStringList selectedFiles_(QListWidget *listwidget) const; QStringList selectedFiles() const; diff --git a/src/SubmoduleMainWindow.cpp b/src/SubmoduleMainWindow.cpp index a5f61143..1a1d0cc2 100644 --- a/src/SubmoduleMainWindow.cpp +++ b/src/SubmoduleMainWindow.cpp @@ -47,6 +47,6 @@ RepositoryWrapperFrame *SubmoduleMainWindow::frame() void SubmoduleMainWindow::reset() { GitPtr g = git(); - mainwindow()->openRepositoryMain(ui->frame_repository_wrapper2, g, true, true, true, false); + mainwindow()->openRepositoryMain(ui->frame_repository_wrapper2, g, true, true, false); }