git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: FORMAT_PATCH_NAME_MAX increase

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
May 30, 2017, 11:36 UTC
Message-ID
<CACBZZX5U=U1bpiFuuxH2t8ZWnmQQAjWm1ji8XYq_6-SJPGL1sw@mail.gmail.com>
In-Reply-To
<99ac8ee7-67b5-5ae7-51cf-6be38de6217f@redhat.com>
On Mon, May 29, 2017 at 10:49 AM, Laszlo Ersek <lersek@redhat.com> wrote:
Show 14 quoted lines
> Hi,
>
> would it be possible to
>
> - increase the FORMAT_PATCH_NAME_MAX macro from 64 to, say, 128?
>
> - Or else to introduce a new git-config knob for it?
>
> I have a small review-helper / interdiff script that matches patches
> from adjacent versions of a series against each other, based on subject
> line. (Using the formatted file name with the patch number stripped.)
> The project in question uses long common prefixes in subjects, and the
> current limit of 64 does not always ensure unicity (again, with the
> number stripped).

I don't see why this shouldn't be made configurable, but more generally if you have a script like this it seems like a futile effort in general to just make the subject longer to solve the general case, consider:

    (cd /tmp/; rm -rf test; git init test; cd test && for i in {1..3};
do touch $i && git add $i && git commit -m"test"; done && git
format-patch -2 && git reset --hard HEAD~2 && git am *patch)
Which now yields:
    0001-test.patch
    0002-test.patch

Git projects in general will have plenty of patches like this, e.g. "fix build" or "update tests" or whatever. Isn't a better solution for your script to e.g. key on git-patch-id?

    $ grep "^From " *patch
    0001-test.patch:From 870e37afa1a5aeb7eef76e607345adcfd4a9022d Mon
Sep 17 00:00:00 2001
    0002-test.patch:From de8c37a1532a4f6ae71ffa65400479ba77438f3b Mon
Sep 17 00:00:00 2001
    $ cat *patch | git patch-id
    c71eb8f2c8c461ba6040668e9d79f996f5a04a61
870e37afa1a5aeb7eef76e607345adcfd4a9022d
    735aff6fb601d7ce99506dc7701be3e8a9b5d38c
de8c37a1532a4f6ae71ffa65400479ba77438f3b

Other potential heuristics could be keying not just on the subject but on the subject + subject of the last N commits for each commit, which should give more of a unique key, or key on the whole commit message etc.

Previous: Junio C HamanoNext: Laszlo Ersek
Message 5 of 11 in “FORMAT_PATCH_NAME_MAX increase”
  1. Laszlo ErsekMay 29, 2017
  2. Junio C HamanoMay 30, 2017
  3. Laszlo ErsekMay 30, 2017
  4. Junio C HamanoMay 30, 2017
  5. Ævar Arnfjörð BjarmasonMay 30, 2017
  6. Laszlo ErsekMay 30, 2017
  7. Laszlo ErsekMay 30, 2017
  8. Ævar Arnfjörð BjarmasonMay 30, 2017
  9. Junio C HamanoMay 30, 2017
  10. Ævar Arnfjörð BjarmasonMay 30, 2017
  11. Laszlo ErsekMay 30, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.