Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libgit2update #153

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
048980a
Reason:
Murmele Sep 7, 2022
b8f76e1
Update build.yml and CMakeLists.txt
exactly-one-kas Sep 7, 2022
2912134
Reason:
Murmele Sep 13, 2022
4651f48
initial approach to reactivate filter apply
Murmele Sep 22, 2022
361aee9
implement filter with streams
Murmele Nov 17, 2022
ba200be
fix build
Murmele Nov 17, 2022
d1d01e9
Reason:
Murmele Nov 17, 2022
3b803a1
Fix build (at least on Windows using Clang)
exactly-one-kas Nov 17, 2022
ac6451b
comment out for now
Murmele Dec 10, 2022
a63dd88
format
Murmele Jan 12, 2023
7b53409
fix test
Murmele Jul 22, 2023
7faf33f
rename to util
Murmele Jul 22, 2023
d3432ca
abort script if any error occurs
Murmele Jul 22, 2023
0d9b9f0
format
Murmele Aug 27, 2023
556e6f0
Check if this helps
Murmele Nov 22, 2023
ebb739b
Merge remote-tracking branch 'origin/master' into libgit2update
Murmele Jun 11, 2024
d188e24
update libgit2
Murmele Jun 11, 2024
de360b9
fix compilation errors
Murmele Jun 11, 2024
f81c694
fix compilation
Murmele Jun 11, 2024
ec66c0e
use system libs
Murmele Jun 11, 2024
682123c
Update libssh2 and openssl
Murmele Jun 11, 2024
e60180d
install libssh2 and use system openssl
Murmele Jun 11, 2024
e7e27c0
cleanup
Murmele Jun 11, 2024
126ee94
missing colon
Murmele Jun 11, 2024
8169d04
libssh2 required
Murmele Jun 11, 2024
4fb03ae
install dev so that the header is available for compilation
Murmele Jun 11, 2024
19a76eb
cmake flags to enable ssh for libgit2
Murmele Jun 11, 2024
3aabc67
TESTING
Murmele Jun 11, 2024
d6ea21a
change branch back
Murmele Jun 11, 2024
ebf2b60
set to off again
Murmele Jun 11, 2024
593d791
if stashRef is invalid it should not checked further.
Murmele Jun 11, 2024
9250db7
remove USE_SSH variable, because libgit2 contains such an option
Murmele Jun 12, 2024
684d6dd
use default
Murmele Jun 15, 2024
5a074eb
patch libgit2 to support local build libssh2
Murmele Jun 15, 2024
7fa1d4b
drop win32 support
Murmele Jun 26, 2024
895b9df
cmake format
Murmele Jun 26, 2024
44456fb
update openssl to version 3.4
Murmele Sep 8, 2024
e5a0de6
Merge remote-tracking branch 'refs/remotes/origin/master'
Murmele Oct 29, 2024
496aa58
Merge remote-tracking branch 'refs/remotes/origin/master'
Murmele Nov 4, 2024
15a05c7
use system openssl for macOS
Murmele Nov 4, 2024
1121015
use correct openssl version
Murmele Nov 4, 2024
a71bb42
update macos version
Murmele Nov 4, 2024
7d644ef
Update to newest commit of openssl 3.4
Murmele Nov 4, 2024
88121ec
force install
Murmele Nov 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 11 additions & 41 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,16 @@ jobs:
qt_arch: gcc_64
openssl_arch: linux-x86_64
ld_library_arch: linux-x86-64
cmake_flags: "-DGENERATE_APPDATA=ON -DCMAKE_INSTALL_PREFIX=/usr -DUSE_SYSTEM_QT=ON -DENABLE_UPDATE_OVER_GUI=OFF"
cmake_flags: "-DGENERATE_APPDATA=ON -DCMAKE_INSTALL_PREFIX=/usr -DUSE_SYSTEM_QT=ON -DENABLE_UPDATE_OVER_GUI=OFF -DUSE_SSH=ON -DUSE_SYSTEM_LIBSSH2=ON -DUSE_SYSTEM_OPENSSL=ON"
pack: 0
cmake_env: {}

- name: macos
os: macos-12
os: macos-13
ninja_platform: mac
qt_platform: mac
openssl_arch: darwin64-x86_64-cc
cmake_flags: "-DUSE_SYSTEM_OPENSSL=ON -DUSE_SSH:STRING=localbuild"
cmake_env: {}
pack: 1

Expand All @@ -154,30 +155,13 @@ jobs:
qt_arch_check_only: win64_msvc2017_64
openssl_arch: VC-WIN64A
msvc_arch: x64
cmake_flags: "-DUSE_BUNDLED_ZLIB=1"
cmake_flags: "-DUSE_SSH:STRING=localbuild"
cmake_env:
CMAKE_RC_FLAGS: "/C 1252"
CC: clang
CXX: clang++
pack: 1

- name: win32
os: windows-latest
ninja_platform: win
qt_platform: windows
qt_arch: win32_msvc2019
qt_arch_check_only: win32_msvc2017
openssl_arch: VC-WIN32
msvc_arch: x86
cmake_flags: "-DUSE_BUNDLED_ZLIB=1"
cmake_env:
CMAKE_RC_FLAGS: "/C 1252"
CC: clang
CXX: clang++
CMAKE_C_FLAGS: -m32
CMAKE_CXX_FLAGS: -m32
pack: 1

steps:
# otherwise the testcases will fail, because signature is invalid
- name: Set git name and email
Expand All @@ -203,6 +187,13 @@ jobs:
with:
perl-version: '5.30'

- name: Install Libssh2
if: matrix.env.ninja_platform == 'linux'
run: |
sudo apt-get update
sudo apt-get -y install libssh2-1
sudo apt-get -y install libssh2-1-dev

- name: Install Qt
uses: jurplel/[email protected]
timeout-minutes: 10
Expand Down Expand Up @@ -244,25 +235,6 @@ jobs:
if: matrix.env.ninja_platform == 'win'
uses: ilammy/[email protected]

- name: Build OpenSSL (Linux)
if: matrix.env.ninja_platform == 'linux'
run: |
cd dep/openssl/openssl
./config -fPIC
make

- name: Build OpenSSL (macOS)
if: matrix.env.ninja_platform == 'mac'
run: |
cd dep/openssl/openssl

# this is necessary until https://github.com/openssl/openssl/issues/18720
# is fixed in OpenSSL 1.1.1r
export CFLAGS=-Wno-error=implicit-function-declaration

./Configure ${{ matrix.env.openssl_arch }} no-shared
make

- name: Build OpenSSL (Windows)
if: matrix.env.ninja_platform == 'win'
run: |
Expand Down Expand Up @@ -403,7 +375,6 @@ jobs:
automatic_release_tag: 'development'
files: |
**/artifacts/Gittyup win64/Gittyup*.exe
**/artifacts/Gittyup win32/Gittyup*.exe
**/artifacts/Gittyup macos/Gittyup*.dmg
**/artifacts/GittyupFlatpak/*.flatpak
**/artifacts/GittyupAppImage/Gittyup*.AppImage
Expand All @@ -418,7 +389,6 @@ jobs:
automatic_release_tag: ${{ github.ref_name }}
files: |
**/artifacts/Gittyup win64/Gittyup*.exe
**/artifacts/Gittyup win32/Gittyup*.exe
**/artifacts/Gittyup macos/Gittyup*.dmg
**/artifacts/GittyupFlatpak/*.flatpak
**/artifacts/GittyupAppImage/Gittyup*.AppImage
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ build
.vscode/
CMakeLists.txt.user
cmake-build-debug/
build*
cmake-build-release/
build
.idea/
.venv
compile_commands.json
tags
.flatpak-builder
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "dep/libgit2/libgit2"]
path = dep/libgit2/libgit2
url = https://github.com/stinb/libgit2.git
url = https://github.com/Murmele/libgit2.git
[submodule "dep/libssh2/libssh2"]
path = dep/libssh2/libssh2
url = https://github.com/libssh2/libssh2.git
Expand Down
17 changes: 16 additions & 1 deletion com.github.Murmele.Gittyup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,24 @@ modules:
- install -Dm755 $(which git-upload-archive) ${FLATPAK_DEST}/bin/
- install -Dm755 $(which git-upload-pack) ${FLATPAK_DEST}/bin/

- name: libssh2
rm-configure: true
sources:
- type: archive
url: https://www.libssh2.org/download/libssh2-1.11.0.tar.gz
sha256: 3736161e41e2693324deb38c26cfdc3efe6209d634ba4258db1cecff6a5ad461
x-checker-data:
type: anitya
project-id: 1730
url-template: https://www.libssh2.org/download/libssh2-$version.tar.gz
- type: script
commands:
- autoreconf -fiv
dest-filename: autogen.sh

- name: Gittyup
buildsystem: cmake-ninja
config-opts: [-DCMAKE_BUILD_TYPE=Release, -DFLATPAK=ON, -DGENERATE_APPDATA=ON, -DENABLE_UPDATE_OVER_GUI=OFF, -DUSE_SYSTEM_OPENSSL:BOOL=ON]
config-opts: [-DCMAKE_BUILD_TYPE=Release, -DFLATPAK=ON, -DGENERATE_APPDATA=ON, -DENABLE_UPDATE_OVER_GUI=OFF, -DUSE_SYSTEM_OPENSSL:BOOL=ON, -DUSE_SSH=ON, -DUSE_SYSTEM_LIBSSH2=ON]
builddir: true
sources:
- type: git
Expand Down
2 changes: 1 addition & 1 deletion dep/git/git
Submodule git updated 1973 files
11 changes: 4 additions & 7 deletions dep/libgit2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@
set(BUILD_SHARED_LIBS
OFF
CACHE BOOL "" FORCE)
set(BUILD_CLAR
set(BUILD_TESTS
OFF
CACHE BOOL "" FORCE)
set(STATIC_CRT
OFF
CACHE BOOL "" FORCE)

# Enabled manually. Don't search for it.
set(USE_SSH
OFF
CACHE BOOL "" FORCE)

if(WIN32)
# Disable search for OpenSSL.
set(USE_OPENSSL
Expand All @@ -34,6 +29,8 @@ endif()

if(NOT USE_SYSTEM_LIBGIT2)
add_subdirectory(libgit2)

# Include the generated experimental.h
target_include_directories(
git2 INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/libgit2/include)
libgit2 INTERFACE ${PROJECT_BINARY_DIR}/dep/libgit2/libgit2/include/git2)
endif()
2 changes: 1 addition & 1 deletion dep/libgit2/libgit2
Submodule libgit2 updated 2416 files
42 changes: 42 additions & 0 deletions dep/libgit2/rebaseGittyupLibgit2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
declare -a branches=("fetch_annotated_tags" "blame_abort" "disableRenameDetection" "checkout_deletion_notification" "diff_checkout" "fix_push_callback_issues" "disable_mmap" "context_line_accessor´" "disableRenameDetection" "hash" "callback_connect_disconnect" "libgit2_includes_public", "local_libssh2")

cd libgit2

git remote remove origin
git remote remove upstream
git remote add origin https://github.com/Murmele/libgit2.git
git remote add upstream https://github.com/libgit2/libgit2.git

git fetch --all

for branch in ${branches[@]}; do
echo $branch
git checkout -B $branch "origin/$branch"
RESULT=$?
if [ $RESULT -gt 0 ]; then
echo "Unable to checkout branch: $branch : Exitcode: $RESULT"
exit 1
fi
git rebase upstream/main
RESULT=$?
if [ $RESULT -gt 0 ]; then
echo "Unable to rebase branch: $branch : Exitcode: $RESULT"
exit 1
fi
done

git checkout Gittyup
git reset --hard upstream/main

for branch in ${branches[@]}; do
git merge --no-edit $branch
RESULT=$?
if [ $RESULT -gt 0 ]; then
echo "Unable to merge branch: $branch : Exitcode: $RESULT"
exit 1
fi
done

git push --force origin

echo "Script finished. Check if all branches are rebased correctly and push them to origin!"
2 changes: 1 addition & 1 deletion dep/libssh2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if(USE_SYSTEM_LIBSSH2)
if(PKG_CONFIG_FOUND)
pkg_check_modules(LIBSSH2 libssh2)
pkg_check_modules(LIBSSH2 REQUIRED libssh2)
endif()

else()
Expand Down
2 changes: 1 addition & 1 deletion dep/libssh2/libssh2
Submodule libssh2 updated 490 files
2 changes: 1 addition & 1 deletion dep/openssl/openssl
Submodule openssl updated 20444 files
7 changes: 3 additions & 4 deletions pack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ if(NOT APPLE)
if(NOT USE_SYSTEM_OPENSSL)
if(WIN32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(SSL_LIB_SUFFIX "-1_1-x64.dll")
set(SSL_LIB_SUFFIX "-3_4-x64.dll")
else()
set(SSL_LIB_SUFFIX "-1_1.dll")
set(SSL_LIB_SUFFIX "-3_4.dll")
endif()
else()
set(SSL_LIB_SUFFIX ".so.1.1")
set(SSL_LIB_SUFFIX ".so.3.4")
endif()

foreach(SSL_LIB_NAME ssl crypto)
Expand All @@ -183,7 +183,6 @@ if(NOT APPLE)
WORLD_READ
WORLD_EXECUTE
COMPONENT ${GITTYUP_NAME}
OPTIONAL # if we use the system libssh, we have not built openssl
)
endforeach()
endif()
Expand Down
2 changes: 1 addition & 1 deletion src/conf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
add_library(conf ConfFile.cpp Settings.cpp Setting.cpp RecentRepositories.cpp
RecentRepository.cpp)

target_link_libraries(conf lua Qt5::Core util translation)
target_link_libraries(conf lua Qt5::Core translation gittyupUtil)

# SRC_ definitions point to the source directly
target_compile_definitions(
Expand Down
3 changes: 2 additions & 1 deletion src/dialogs/SubmoduleTableModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ bool SubmoduleTableModel::setData(const QModelIndex &index,
QMessageBox::Warning, tr("Deinitialize Submodule?"), text,
QMessageBox::Cancel, qobject_cast<QWidget *>(parent()));

if (GIT_SUBMODULE_STATUS_IS_WD_DIRTY(submodule.status()))
if (GIT_SUBMODULE_STATUS_IS_WD_DIRTY(
mRepo.submoduleStatus(submodule.name())))
mb->setInformativeText(
tr("The submodule working directory contains uncommitted "
"changes that will be lost if you continue."));
Expand Down
2 changes: 1 addition & 1 deletion src/git/Branch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Remote Branch::remote() const {
return up.isValid() ? up.remote() : Remote();
}

git_buf buf = GIT_BUF_INIT_CONST(nullptr, 0);
git_buf buf = GIT_BUF_INIT;
git_repository *repo = git_reference_owner(d.data());
if (git_branch_remote_name(&buf, repo, qualifiedName().toUtf8()))
return Remote();
Expand Down
6 changes: 3 additions & 3 deletions src/git/Buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
//

#include "Buffer.h"
#include "git2/blob.h"

namespace git {

Buffer::Buffer(const char *data, int size)
: d(GIT_BUF_INIT_CONST(data, size)) {}
Buffer::Buffer(const char *data, int size) : data(data), size(size) {}

bool Buffer::isBinary() const { return git_buf_is_binary(&d); }
bool Buffer::isBinary() const { return git_blob_data_is_binary(data, size); }

} // namespace git
5 changes: 2 additions & 3 deletions src/git/Buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#ifndef BUFFER_H
#define BUFFER_H

#include "git2/buffer.h"

namespace git {

class Buffer {
Expand All @@ -21,7 +19,8 @@ class Buffer {
bool isBinary() const;

private:
git_buf d;
const char *data;
const int size;
};

} // namespace git
Expand Down
5 changes: 4 additions & 1 deletion src/git/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ add_library(
TagRef.cpp
Tree.cpp)

target_link_libraries(git git2 Qt5::Core Qt5::Network util)
# we need both libgit2package and libgit2 otherwise we can't find the header
# files
target_link_libraries(git libgit2package libgit2 gittyupUtil Qt5::Core
Qt5::Network)

set_target_properties(git PROPERTIES AUTOMOC ON)
4 changes: 2 additions & 2 deletions src/git/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ QString Config::value<QString>(const QString &key,
return defaultValue;
}

git_buf buf = GIT_BUF_INIT_CONST(nullptr, 0);
git_buf buf = GIT_BUF_INIT;
git_config_get_string_buf(&buf, d.data(), key.toUtf8());
QString value = QString::fromUtf8(buf.ptr, buf.size);
git_buf_dispose(&buf);
Expand Down Expand Up @@ -182,7 +182,7 @@ QString Config::globalPath() {
config.remove("global.force");
}

git_buf buf = GIT_BUF_INIT_CONST(nullptr, 0);
git_buf buf = GIT_BUF_INIT;
git_config_find_global(&buf);
QString path = QString::fromUtf8(buf.ptr, buf.size);
git_buf_dispose(&buf);
Expand Down
Loading
Loading