tools.linux.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Herbert <marc.herbert@linux.intel.com>
To: tools@kernel.org
Subject: Unreleased, multi-lines git_filter_repo fix required to run b4 tests?
Date: Thu, 30 Oct 2025 20:49:01 -0700	[thread overview]
Message-ID: <m2zf97ybma.fsf@C02X38VBJHD2mac.jf.intel.com> (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
+++ ./.venv/lib/python3.13/site-packages/git_filter_repo.py
@@ -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):


             reply	other threads:[~2025-10-31  3:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-31  3:49 Marc Herbert [this message]
2025-10-31 14:00 ` Unreleased, multi-lines git_filter_repo fix required to run b4 tests? Konstantin Ryabitsev
2025-11-01  3:28   ` Marc Herbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2zf97ybma.fsf@C02X38VBJHD2mac.jf.intel.com \
    --to=marc.herbert@linux.intel.com \
    --cc=tools@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).