[Bug 297041] Pre-commit hook incorrectly rejects commits that add missing newline at EOF
[email protected] Sat, 25 Jul 2026 08:34:30 +0000
| Newsgroups | gmane.os.freebsd.devel.documentation |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D297041
Bug ID: 297041
Summary: Pre-commit hook incorrectly rejects commits that add
missing newline at EOF
Product: Documentation
Version: Latest
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: Website
Assignee: [email protected]
Reporter: [email protected]
I am trying to commit a fix to the doc tree that adds a missing newline at =
the
end of a file. However, the pre-receive hook rejects the commit with the
following error:
Total 12 (delta 7), reused 0 (delta 0), pack-reused 0 (from 0)
remote:=20
remote: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
remote: Some files in your commit does not have newline at end
remote: of file. Please fix this and try committing again.
remote: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
remote:=20
To gitrepo.freebsd.org:doc.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'gitrepo.freebsd.org:doc.git'
It appears that a new server-side hook has been introduced to prevent files
without a trailing newline from being committed. However, the hook does not
distinguish between:
1. Adding a new file without a trailing newline (bad)
2. Fixing an existing file by adding the missing newline (good)
The hook rejects both cases because the diff output for adding a missing
newline looks identical to modifying a line (the hook likely detects that a
line was changed, but the newline character itself is not visible in the di=
ff
context).
Example diff when fixing a missing newline - what I am trying to push:
-=D0=9A=D0=B0=D0=B9=D0=BB =D0=AD=D0=B2=D0=B0=D0=BD=D1=81 (=D0=BE=D1=82 =D0=
=B8=D0=BC=D0=B5=D0=BD=D0=B8 core@)
\ No newline at end of file
+=D0=9A=D0=B0=D0=B9=D0=BB =D0=AD=D0=B2=D0=B0=D0=BD=D1=81 (=D0=BE=D1=82 =D0=
=B8=D0=BC=D0=B5=D0=BD=D0=B8 core@)
+
The hook appears to check for the `\ No newline at end of file` marker in t=
he
diff but does not account for commits that remove this marker by adding the
newline.
Expected behavior:
The hook should allow commits that only add a newline at the end of the file
(i.e., commits that remove the `\ No newline at end of file` marker from the
diff).
Suggested fix:
Could this hook be disabled until all newlines at EOF checked and fixed?=20
Additional information
The file in question: website/content/ru/news/2026-ports-freeze/_index.adoc
Please let me know if additional information or testing is needed.
Thanks,
Vladlen Popolitov
--=20
You are receiving this mail because:
You are the assignee for the bug.=