Skip to contentSkip to conversation

Unreleased, multi-lines git_filter_repo fix required to run b4 tests?

PATCH Marc Herbert 2 participants 3 messages Oct 31, 2025 – Nov 1, 2025

lore
Share & tools
lore
#0 lore raw

Hi,

I learned the really hard way that I need this multi-lines
git_filter_repo.py fix at the bottom to successfully run "uv run pytest".

- 100% pass rate _with_ that fix applied on top of git_filter_repo.py v2.47
- 3 tests failing _without_ that fix:

FAILED src/tests/test_ez.py::test_trailers[trailers-thread-with-followups-None-None-trargs0-compareargs0-trailers-thread-with-followups-b4cfg0] - ValueError: dictionary update sequence element #35 has length 1; 2 is required FAILED src/tests/test_ez.py::test_trailers[trailers-thread-with-cover-followup-None-None-trargs1-compareargs1-trailers-thread-with-cover-followup-b4cfg1] - ValueError: dictionary update sequence element #35 has length 1; 2 is required FAILED src/tests/test_ez.py::test_trailers[trailers-thread-with-followups-trailers-with-tripledash-None-trargs3-compareargs3-trailers-thread-with-followups-and-tripledash-None] - ValueError: dictionary update sequence element #35 has length 1; 2 is required

These 3 tests fail because they do use a (very long) multi-line git config:

[branch "b4/pytest"]
b4-prep-cover-strategy = branch-description
description = "EDITME: cover title for pytest\n\n# Describe the pur...
^^^^

As found with "uv run pytest --pdb", they crash exactly where the fix is.

Unfortunately, this fix is part of git_filter_repo.py version... 2.48 which is not released yet!?
https://pypi.org/project/git-filter-repo/#history

So what really baffles me is: how come no one else noticed this before? Maybe some recent change in the default "git config --list" output format? Reproduced with git --version 2.51 and today's b4 509f56ff5c24 in case that matters.

PS: if some uv expert knows how to hack the uv configuration to use a local git_filter_repo version in the virtual environment, by all means please share.

https://github.com/newren/git-filter-repo/commit/4697eeb37b7c3c30b

.venv/lib/python3.13/site-packages/git_filter_repo.py +3 -3
@@ -1683,14 +1683,14 @@
   def get_config_settings(repo_working_dir):
     output = ''
     try:
-      output = subproc.check_output('git config --list'.split(),
+      output = subproc.check_output('git config --list --null'.split(),
                                     cwd=repo_working_dir)
     except subprocess.CalledProcessError as e: # pragma: no cover
       raise SystemExit('fatal: {}'.format(e))
 
     # FIXME: Ignores multi-valued keys, just let them overwrite for now
-    return dict(line.split(b'=', maxsplit=1)
-                for line in output.strip().split(b"\n"))
+    return dict(item.split(b'\n', maxsplit=1)
+                for item in output.strip().split(b"\0") if item)
 
   @staticmethod
   def get_blob_sizes(quiet = False):
#1 lore raw
Quoted 1 line · Marc Herbert

So what really baffles me is: how come no one else noticed this before?

They have -- it's a recurring problem for packagers. I've been prodding git-filter-repo to release a fixed version -- if more people tell them about it, maybe this will actually happen?

This bug doesn't really affect real usage of b4, because this only manifests itself when someone sets the cover letter strategy to use git branch descriptions (which is what tests do).

-K

#2 lore raw
Quoted 4 lines · Konstantin Ryabitsev
Quoted 1 line · Marc Herbert

So what really baffles me is: how come no one else noticed this before?

They have -- it's a recurring problem for packagers.

Ha, then I was searching in the wrong place: here.

But wait... only packagers run tests? Not the people submitting b4 changes on this list!?

The "xfail" patch I just submitted should be enough to please packagers.

Quoted 2 lines

I've been prodding git-filter-repo to release a fixed version -- if more people tell them about it, maybe this will actually happen?

Not sure what is a good stick there but for sure my xfail patch and the corresponding effort should provide strong, additional evidence of how painful this has been - whether you merge it or not. So... I've done my share? :-)

Quoted 3 lines

This bug doesn't really affect real usage of b4, because this only manifests itself when someone sets the cover letter strategy to use git branch descriptions (which is what tests do).

Good to know, thx.