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

gigantic commit messages, was Re: Git Bug Report: out of memory using git tag

From
Jeff King <peff@peff.net>
Date
Nov 2, 2022, 09:13 UTC
Message-ID
<Y2I0siBlVOngNUtK@coredump.intra.peff.net>
In-Reply-To
<CABPp-BGmNqV5H5meMggKYTcTJDxxt5dRT3rZRnRPz496OJn3Vg@mail.gmail.com>
On Wed, Nov 02, 2022 at 01:14:59AM -0700, Elijah Newren wrote:
Show 13 quoted lines
> On Wed, Nov 2, 2022 at 12:51 AM Jeff King <peff@peff.net> wrote:
> >
> > Here are patches which fix them both. I may be setting a new record for
> > the ratio of commit message lines to changed code
> 
> It looks like the first patch is 72 lines of commit message for a
> one-line fix, and the second patch is 61 lines of commit message for a
> two line fix.
> 
> I don't know what the record ratio is, but it's at least 96[1], so
> clearly you'll need to figure out how to pad your first commit message
> with at least another 25 lines before this series can be accepted.
> ;-)
Well, if we want to start digging things up... ;)
Try this:
  git log --no-merges --no-renames --format='%H %B' -z --numstat '*.c' |
  perl -0ne '
    chomp;
    if (s/^([0-9a-f]{40}) //) {
      if (defined $commit && $diff) {
        my $ratio = $body / $diff;
        print "$ratio $body $diff $commit\n";
      }
      $commit = $1;
      $body = () = /\n/g;
      $diff = 0;
    } elsif (/^\s*(\d+)\t/) {
      # this counts only added lines, under the assumption that
      # small commits generally remove/add in proportion. Of course
      # ones that _only_ remove lines have infinite ratios.
      $diff += $1;
    } else {
      die "confusing record: $_\n";
    }
  ' |
  sort -rn |
  head
which shows there are a few in the 100's. Pipe through:
  awk '{print $4}' |
  git log --stdin --no-walk=unsorted --stat

for a nicer view. I'm rejecting the top one on the grounds that it's mostly cut-and-paste output, and also that #2 is mine. ;)

-Peff
Previous: Elijah NewrenNext: Ævar Arnfjörð Bjarmason
Message 8 of 15 in “Git Bug Report: out of memory using git tag”
  1. Martin EnglundOct 28, 2022
  2. Jeff KingNov 1, 2022
  3. Philippe BlainNov 2, 2022
  4. Jeff KingNov 2, 2022
  5. 1/2 ref-filter: fix parsing of signatures without blank linesJeff King, Nov 2, 2022
  6. 2/2 ref-filter: fix parsing of signatures with CRLF and no bodyJeff King, Nov 2, 2022
  7. Elijah NewrenNov 2, 2022
  8. gigantic commit messages, was Re: Git Bug Report: out of memory using git tagJeff King, Nov 2, 2022
  9. Ævar Arnfjörð BjarmasonNov 2, 2022
  10. Elijah NewrenNov 2, 2022
  11. Eric SunshineNov 2, 2022
  12. Philippe BlainNov 2, 2022
  13. Jeff KingNov 3, 2022
  14. Taylor BlauNov 3, 2022
  15. Philippe BlainNov 2, 2022

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.