Skip to content

spacecheck: cap number of lines per file - #22387

Closed
vszakats wants to merge 3 commits into
curl:masterfrom
vszakats:maxlines
Closed

spacecheck: cap number of lines per file#22387
vszakats wants to merge 3 commits into
curl:masterfrom
vszakats:maxlines

Conversation

@vszakats

@vszakats vszakats commented Jul 24, 2026

Copy link
Copy Markdown
Member

To prevent merging large text files by accident.

Set the cap at 10k lines. The current line number top list is:

    5577 configure.ac
    5561 lib/vtls/openssl.c
    5077 lib/http.c
    4517 lib/ftp.c
    4284 lib/multi.c

To prevent merging large text files by accident.
Copilot AI review requested due to automatic review settings July 24, 2026 18:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates scripts/spacecheck.pl to reduce the risk of accidentally committing/merging extremely large text files by adding a per-file maximum line-count check.

Changes:

  • Refactors eol_detect() to use precomputed CR/LF counts instead of scanning content internally.
  • Adds a max_lines threshold (10,000) and reports an error when exceeded.
  • Adjusts the mixed-EOL error text to hint at possible binary content.
Comments suppressed due to low confidence (1)

scripts/spacecheck.pl:144

  • After removing the unused $content parameter from eol_detect(), update this call site to pass only the CR/LF counts.
    my $eol = eol_detect($content, $cnt_cr, $cnt_lf);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/spacecheck.pl Outdated
Comment thread scripts/spacecheck.pl
Comment thread scripts/spacecheck.pl
Copilot AI review requested due to automatic review settings July 24, 2026 18:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 24, 2026 19:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@testclutch

This comment was marked as outdated.

@vszakats vszakats closed this in c4dcdb8 Jul 25, 2026
@vszakats
vszakats deleted the maxlines branch July 25, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants