From nobody Fri Nov 25 16:25:16 2022 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NJgFS4b1cz4jB4n; Fri, 25 Nov 2022 16:25:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NJgFS3fKnz494Q; Fri, 25 Nov 2022 16:25:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669393516; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dkwD0lT6Xr8DhOFAWnIPo95i6Wct4SkpZbypR9ZQAH8=; b=WbOGGSYYGOfNLq5ak9ACt43/VLaHoTKZm2L+5c3sf7PO38Bs8tHseijC8lDTPMucjeqgXc h2CPpzmVMmFhR9n6yawYARdXwJFlC+8MWxJVDZJtXr+MbUgPLA5RHMSkjyQTXnmEgD3yWb 8waRJ2DPaA7sraMw4i/9lNs9Kx95kNtr0j1PgMG6JW3pRaJxAElNhh2gdeb1Ej/Dj6M7xM H2f+qccWO1IDQioppRcxN+qQZ7Jrhgzlu5CQzXMX5VtpXbkcp9zhMiT82x0UxoOYDxAeCU BxRrRRCSohhFXE229uBDV2n6y0zCCQwoimXZdyZpZ4LMYBvr8hKgI+lnmb948w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669393516; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dkwD0lT6Xr8DhOFAWnIPo95i6Wct4SkpZbypR9ZQAH8=; b=reoo1QepSznMEr6y3s+MLlk7Vh95Fw78Bpg+Q+K2XF271a+JPU44gtyR86FeneX1q/sqcc +Sh+C8/iv+xpFR7MTGLKWK2saggHNIAR17A3AzChA10UklStNk6bIef3OWsUHqE6LYo5oq jqEsz723OH/RG3TTrLB9bRLs0e6gPVGEHw9/Aj5qVUMK/uFifVjLEeus+LXuLDssJECZ7y c3lq1TvnYlOhqlsqYuKpGy2H7auWHL0YKzl7a5Y/c5KzeJ5rehDAl09PBeB2jiUtS1FvI4 zhsU4vgS3FhY8hdbB/RswV/PeYNaoPDzJ+cstzovPyM9lpe1IYm52HnOWbW3Kw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669393516; a=rsa-sha256; cv=none; b=UcpNeKCba30suP9P6PQOy/IoICN0JRZNiCpbu9OhySeQY92Ly2FcPR0zYemwrRLUxdFPwU UslVhkT9FwPR3tbb46VqdI6L/EpyJ5UVnWEY0cKdVz0Hx1TKU0H3LSvMbH7bt05ll/epkx mXT4IgAZ5F4Iz9x2Q2EJF/S+PSBkkykrHE8CYZg4k+aejx8JozpgB/+AaiRxxnGOrGS9zn pniSsJo6aDFJaEGo+v/FeetaCs+bFlkvVwRtnlOWMeIbkwrtDzvKXwokCoGRGzYw3Ehy+d vGaCScOVHTOVA3RPS0OukOafXBJoGWbgDsooaTDq15TcfWI+g05Zzd6aSEtG5g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NJgFS2ZC3zmr0; Fri, 25 Nov 2022 16:25:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2APGPGc6068042; Fri, 25 Nov 2022 16:25:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2APGPG9M068041; Fri, 25 Nov 2022 16:25:16 GMT (envelope-from git) Date: Fri, 25 Nov 2022 16:25:16 GMT Message-Id: <202211251625.2APGPG9M068041@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Guido Falsi Subject: git: 01025d932b43 - main - devel/geany-plugin-git-changebar: Fix build with libgit2 1.5.0 List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: madpilot X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 01025d932b437ac790a9511a9d36d7f0717772b1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by madpilot: URL: https://cgit.FreeBSD.org/ports/commit/?id=01025d932b437ac790a9511a9d36d7f0717772b1 commit 01025d932b437ac790a9511a9d36d7f0717772b1 Author: Guido Falsi AuthorDate: 2022-11-25 16:23:05 +0000 Commit: Guido Falsi CommitDate: 2022-11-25 16:23:05 +0000 devel/geany-plugin-git-changebar: Fix build with libgit2 1.5.0 Import patches from upstream master branch to fix build with recently committed libgit2 1.5.0. Reported by: fallout Obtained from: https://github.com/geany/geany-plugins/commit/668f5d07eef16e227402eab09141c738b315d94b https://github.com/geany/geany-plugins/commit/5d9f1bc6d010e6b4c6a21af8a39b90922f89a82c --- .../files/patch-git-changebar_src_gcb-plugin.c | 137 +++++++++++++++++++++ 1 file changed, 137 insertions(+) diff --git a/devel/geany-plugin-git-changebar/files/patch-git-changebar_src_gcb-plugin.c b/devel/geany-plugin-git-changebar/files/patch-git-changebar_src_gcb-plugin.c new file mode 100644 index 000000000000..50e1498290e3 --- /dev/null +++ b/devel/geany-plugin-git-changebar/files/patch-git-changebar_src_gcb-plugin.c @@ -0,0 +1,137 @@ +--- git-changebar/src/gcb-plugin.c.orig 2021-09-19 13:29:36 UTC ++++ git-changebar/src/gcb-plugin.c +@@ -32,11 +32,19 @@ + #include + #include + +-#if ! defined (LIBGIT2_VER_MINOR) || ( (LIBGIT2_VER_MAJOR == 0) && (LIBGIT2_VER_MINOR < 22) ) ++#ifdef LIBGIT2_VER_MINOR ++# define CHECK_LIBGIT2_VERSION(MAJOR, MINOR) \ ++ ((LIBGIT2_VER_MAJOR == (MAJOR) && LIBGIT2_VER_MINOR >= (MINOR)) || \ ++ LIBGIT2_VER_MAJOR > (MAJOR)) ++#else /* ! defined(LIBGIT2_VER_MINOR) */ ++# define CHECK_LIBGIT2_VERSION(MAJOR, MINOR) 0 ++#endif ++ ++#if ! CHECK_LIBGIT2_VERSION(0, 22) + # define git_libgit2_init git_threads_init + # define git_libgit2_shutdown git_threads_shutdown + #endif +-#if ! defined (LIBGIT2_VER_MINOR) || ( (LIBGIT2_VER_MAJOR == 0) && (LIBGIT2_VER_MINOR < 23) ) ++#if ! CHECK_LIBGIT2_VERSION(0, 23) + /* 0.23 added @p binary_cb */ + # define git_diff_buffers(old_buffer, old_len, old_as_path, \ + new_buffer, new_len, new_as_path, options, \ +@@ -45,7 +53,7 @@ + new_buffer, new_len, new_as_path, options, \ + file_cb, hunk_cb, line_cb, payload) + #endif +-#if ! defined (LIBGIT2_VER_MINOR) || ( (LIBGIT2_VER_MAJOR == 0) && (LIBGIT2_VER_MINOR < 28) ) ++#if ! CHECK_LIBGIT2_VERSION(0, 28) + # define git_buf_dispose git_buf_free + # define git_error_last giterr_last + #endif +@@ -211,30 +219,19 @@ static const struct { + }; + + +-/* workaround https://github.com/libgit2/libgit2/pull/3187 */ +-static int +-gcb_git_buf_grow (git_buf *buf, +- size_t target_size) +-{ +- if (buf->asize == 0) { +- if (target_size == 0) { +- target_size = buf->size; +- } +- if ((target_size & 7) == 0) { +- target_size++; +- } +- } +- return git_buf_grow (buf, target_size); +-} +-#define git_buf_grow gcb_git_buf_grow +- + static void + buf_zero (git_buf *buf) + { + if (buf) { + buf->ptr = NULL; + buf->size = 0; ++#if ! CHECK_LIBGIT2_VERSION(1, 4) + buf->asize = 0; ++#else ++ /* we don't really need this field, but the documentation states that all ++ * fields should be set to 0, so fill it as well */ ++ buf->reserved = 0; ++#endif + } + } + +@@ -248,6 +245,52 @@ clear_cached_blob_contents (void) + G_blob_contents_tag = 0; + } + ++/* similar to old git_blob_filtered_content() but makes sure the caller owns ++ * the data in the output buffer -- and uses a boolean return */ ++static gboolean ++get_blob_contents (git_buf *out, ++ git_blob *blob, ++ const char *as_path, ++ int check_for_binary_data) ++{ ++/* libgit2 1.4 changed buffer API quite a bit */ ++#if ! CHECK_LIBGIT2_VERSION(1, 4) ++ gboolean success = TRUE; ++ ++ if (git_blob_filtered_content (out, blob, as_path, ++ check_for_binary_data) != 0) ++ return FALSE; ++ ++ /* Workaround for https://github.com/libgit2/libgit2/pull/3187 ++ * We want to own the buffer, which git_buf_grow(buf, 0) was supposed to do, ++ * but there is a corner case where it doesn't do what it should and ++ * truncates the buffer contents, so we fix this manually. */ ++ if (out->asize == 0) { ++ size_t target_size = out->size; ++ if ((target_size & 7) == 0) { ++ target_size++; ++ } ++ success = (git_buf_grow (out, target_size) == 0); ++ } ++ ++ return success; ++#else /* libgit2 >= 1.4 */ ++ /* Here we can assume we will always get a buffer we own (at least as of ++ * 2022-06-05 it is the case), so there's no need for a pendent to the ++ * previous git_buf_grow() shenanigans. ++ * This code path does the same as the older git_blob_filtered_content() ++ * but with non-deprecated API */ ++ git_blob_filter_options opts = GIT_BLOB_FILTER_OPTIONS_INIT; ++ ++ if (check_for_binary_data) ++ opts.flags |= GIT_BLOB_FILTER_CHECK_FOR_BINARY; ++ else ++ opts.flags &= ~GIT_BLOB_FILTER_CHECK_FOR_BINARY; ++ ++ return git_blob_filter(out, blob, as_path, &opts) == 0; ++#endif ++} ++ + /* get the file blob for @relpath at HEAD */ + static gboolean + repo_get_file_blob_contents (git_repository *repo, +@@ -271,11 +314,8 @@ repo_get_file_blob_contents (git_repository *repo, + git_blob *blob; + + if (git_blob_lookup (&blob, repo, git_tree_entry_id (entry)) == 0) { +- if (git_blob_filtered_content (contents, blob, relpath, +- check_for_binary_data) == 0 && +- git_buf_grow (contents, 0) == 0) { +- success = TRUE; +- } ++ success = get_blob_contents (contents, blob, relpath, ++ check_for_binary_data); + git_blob_free (blob); + } + git_tree_entry_free (entry);