diff --git a/srcpkgs/git-filter-repo/patches/fix-replace-text-for-python3-14.patch b/srcpkgs/git-filter-repo/patches/fix-replace-text-for-python3-14.patch new file mode 100644 index 00000000000000..89b464fdb480f3 --- /dev/null +++ b/srcpkgs/git-filter-repo/patches/fix-replace-text-for-python3-14.patch @@ -0,0 +1,64 @@ +From c1d8461ee34c6d3f987e0f19191f2105cb2a33c8 Mon Sep 17 00:00:00 2001 +From: Elijah Newren +Date: Fri, 25 Jul 2025 21:24:54 -0700 +Subject: [PATCH] filter-repo: fix --replace-text for python3.14 + +Our handling of globs for --replace-text makes use of fnmatch.translate +from the python standard library. Unfortunately, fnmatch.translate +doesn't just give a regex that can match the given glob somewhere, it +gives a regex that will only match if the string it is comparing to is +exactly that glob. We need a substring search, though, so we have to +use an ugly hack to butcher the returned regex from fnmatch to get it +to be what we want. (It would be nice if python's fnmatch.translate() +took options for what was wanted, but it doesn't.) This is fine, except +that... + +python3.14 added '\z' as a synonym for '\Z' in regexes. No special +reason, they just wanted there to be more than one way to do it. + +Naturally, fnmatch.translate() uses '\z' instead of '\Z', so our regex +hackery in glob_to_regex() wasn't looking for the right stuff to hack +off, causing the globs to fail to match text as expected. + +Add a python >= 3.14 hack to the existing python variation hacks in +glob_to_regex() so we can handle this case too. + +While at it, the --replace-text test in t9394 did replacements on a +literal, a glob, and a regex, but it only verified that the glob and +regex replacements worked. Supplement it with a check that the +literal replacement worked too. + +Signed-off-by: Elijah Newren +--- + git-filter-repo | 3 +++ + t/t9394-filter-repo-sanity-checks-and-bigger-repo-setup.sh | 3 +++ + 2 files changed, 6 insertions(+) + +diff --git a/git-filter-repo b/git-filter-repo +index 39c8680a..fb3de42e 100755 +--- a/git-filter-repo ++++ b/git-filter-repo +@@ -154,6 +154,9 @@ def glob_to_regex(glob_bytestr): + regex = regex[0:-7] + elif regex.startswith(r'(?s:') and regex.endswith(r')\Z'): # pragma: no cover + regex = regex[4:-3] ++ elif regex.startswith(r'(?s:') and regex.endswith(r')\z'): # pragma: no cover ++ # Yaay, python3.14 for senselessly duplicating \Z as \z... ++ regex = regex[4:-3] + + # Finally, convert back to regex operating on bytestr + return regex.encode() +diff --git a/t/t9394-filter-repo-sanity-checks-and-bigger-repo-setup.sh b/t/t9394-filter-repo-sanity-checks-and-bigger-repo-setup.sh +index 0ff911db..5358cd5a 100755 +--- a/t/t9394-filter-repo-sanity-checks-and-bigger-repo-setup.sh ++++ b/t/t9394-filter-repo-sanity-checks-and-bigger-repo-setup.sh +@@ -654,6 +654,9 @@ test_expect_success '--replace-text all options' ' + git show HEAD~4:numbers/medium.num >actual && + test_cmp expect actual && + ++ echo "foodstuff" >expect && ++ test_cmp expect sequence/to && ++ + echo "haphazard ***REMOVED*** variation" >expect && + test_cmp expect whatever + ) diff --git a/srcpkgs/git-filter-repo/template b/srcpkgs/git-filter-repo/template index c76e99467f79b5..3e6da0d6fa3cb6 100644 --- a/srcpkgs/git-filter-repo/template +++ b/srcpkgs/git-filter-repo/template @@ -1,7 +1,7 @@ # Template file for 'git-filter-repo' pkgname=git-filter-repo -version=2.34.0 -revision=5 +version=2.47.0 +revision=1 depends="git python3" checkdepends="git python3 perl rsync dos2unix" short_desc="Versatile tool for rewriting git history" @@ -9,7 +9,7 @@ maintainer="Cameron Nemo " license="MIT" homepage="https://github.com/newren/git-filter-repo/" distfiles="https://github.com/newren/git-filter-repo/releases/download/v${version}/git-filter-repo-${version}.tar.xz" -checksum=b1bf46af1e6a91a54056d0254e480803db8e40f631336c559a1a94d2a08389c4 +checksum=4662cbe5918196a9f1b5b3e1211a32e61cff1812419c21df4f47c5439f09e902 do_check() { t/run_tests