Skip to content

mimalloc integration - #2708

Open
Vansh-kap-98 wants to merge 4 commits into
sourcemeta:mainfrom
Vansh-kap-98:feature/mimalloc-integration
Open

mimalloc integration#2708
Vansh-kap-98 wants to merge 4 commits into
sourcemeta:mainfrom
Vansh-kap-98:feature/mimalloc-integration

Conversation

@Vansh-kap-98

@Vansh-kap-98 Vansh-kap-98 commented Aug 6, 2026

Copy link
Copy Markdown

Overview

This PR integrates mimalloc as an optional allocator path to significantly improve memory allocation performance during core benchmarking. The default allocator behavior remains unchanged for standard execution, ensuring stability while allowing us to specifically test and leverage mimalloc where intended.

1. Dependency and Vendoring Changes

  • Added mimalloc as a pinned vendored dependency in DEPENDENCIES.
  • Added a dedicated vendor mask file (mimalloc.mask) to strip non-essential upstream content during vendorpull. This keeps the vendored tree minimal for the repository's build use (cmake, include, src, etc.) and avoids carrying extra upstream documentation, tests, or tooling.
  • Hardened vendor-mask line endings to ensure future pulls are perfectly reproducible.

2. Build-System Integration

  • Added a new finder/build wrapper at FindMimalloc.cmake.
  • Configured the module to point to the vendored source directory via MIMALLOC_DIR.
  • Configured mimalloc with the intended options (static build path, tests/object output disabled, override enabled).
  • Utilized add_subdirectory so mimalloc is correctly built by its own upstream CMake logic.
  • Defined an internal alias target Mimalloc::Mimalloc for clean linking by project targets.

3. Results and findings

Aggregate of 10 runs for each, system vs mimalloc, major comparisons are as follows (><5%)

1. Regex Operations

Benchmark Performance Change
Regex_Lower_S_Or_Upper_S_Asterisk +11.4% Improvement
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar +10.0% Improvement
Regex_Period_Asterisk +9.6% Improvement
Regex_Group_Period_Asterisk_Group +11.0% Improvement
Regex_Period_Plus +11.3% Improvement
Regex_Period +11.4% Improvement
Regex_Caret_Period_Plus_Dollar +11.2% Improvement
Regex_Caret_Group_Period_Plus_Group_Dollar +10.2% Improvement
Regex_Caret_Period_Asterisk_Dollar +49.1% Improvement
Regex_Caret_Group_Period_Asterisk_Group_Dollar +59.7% Improvement
Regex_Caret_X_Hyphen +64.7% Improvement
Regex_Period_Md_Dollar +53.6% Improvement
Regex_Caret_Slash_Period_Asterisk +67.4% Improvement
Regex_Caret_Period_Range_Dollar +56.6% Improvement
Regex_Nested_Backtrack +54.8% Improvement

2. JSON & JSON-LD Operations

Benchmark Performance Change
JSON_Array_Of_Objects_Unique +44.6% Improvement
JSON_Parse_1 +49.5% Improvement
JSON_Parse_Real +56.2% Improvement
JSON_Parse_Decimal +53.6% Improvement
JSON_Parse_Schema_ISO_Language +53.1% Improvement
JSON_Parse_Integer +49.9% Improvement
JSON_Parse_String_NonSSO_Plain +52.7% Improvement
JSON_Parse_String_SSO_Plain +46.7% Improvement
JSON_Parse_String_Escape_Heavy +48.7% Improvement
JSON_Parse_Object_Short_Keys +48.3% Improvement
JSON_Parse_Object_Scalar_Properties +47.7% Improvement
JSON_Parse_Object_Array_Properties +44.6% Improvement
JSON_Parse_Object_Object_Properties +46.2% Improvement
JSON_Parse_Nested_Containers +50.7% Improvement
JSON_From_String_Copy +53.0% Improvement
JSON_From_String_Temporary +41.7% Improvement
JSON_Number_To_Double +6.2% Improvement
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10 +5.7% Improvement
JSON_String_Fast_Hash/10 +8.5% Improvement
JSON_String_Fast_Hash/100 +6.9% Improvement
JSON_String_Key_Hash/10 25.0% Regression
JSONL_Parse_Large +41.8% Improvement
JSONLD_Catalog_Annotation_List_Populate +7.9% Improvement
JSONLD_Catalog_Materialize +8.1% Improvement

3. Pointer & JSONPath Operations

Benchmark Performance Change
Pointer_Object_Traverse +48.5% Improvement
Pointer_Object_Try_Traverse +55.1% Improvement
Pointer_Push_Back_Pointer_To_Weak_Pointer +45.0% Improvement
Pointer_Walker_Schema_ISO_Language +48.7% Improvement
Pointer_Maybe_Tracked_Deeply_Nested/0 +48.5% Improvement
Pointer_Maybe_Tracked_Deeply_Nested/1 +50.0% Improvement
Pointer_Position_Tracker_Get_Deeply_Nested +51.5% Improvement
JSONPath_Descendant_Filter_Nested +49.8% Improvement

4. URI Template Router Operations

Benchmark Performance Change
URITemplateRouter_Create +55.0% Improvement
URITemplateRouter_Match +62.5% Improvement
URITemplateRouter_Match_BasePath +51.0% Improvement
URITemplateRouterView_Restore +69.3% Improvement
URITemplateRouterView_Match +53.4% Improvement
URITemplateRouterView_Match_BasePath +52.7% Improvement
URITemplateRouterView_Arguments +58.4% Improvement

Review in cubic

Signed-off-by: Vansh <officialbusiness9818@gmail.com>
@Vansh-kap-98
Vansh-kap-98 force-pushed the feature/mimalloc-integration branch from 98b80e7 to 66cfe1d Compare August 6, 2026 07:47

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread benchmark/CMakeLists.txt Outdated
Comment thread benchmark/CMakeLists.txt Outdated
Comment thread benchmark/CMakeLists.txt
Comment thread cmake/FindMimalloc.cmake Outdated
Comment thread cmake/FindMimalloc.cmake Outdated
Comment thread CMakeLists.txt Outdated
@Vansh-kap-98
Vansh-kap-98 marked this pull request as draft August 6, 2026 10:04
… benchmark CMakeLists

Signed-off-by: Vansh <officialbusiness9818@gmail.com>
@Vansh-kap-98
Vansh-kap-98 marked this pull request as ready for review August 6, 2026 11:21

@cubic-dev-ai cubic-dev-ai Bot 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.

2 issues found across 58 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="cmake/FindMimalloc.cmake">

<violation number="1" location="cmake/FindMimalloc.cmake:16">
P2: When a static mimalloc with MI_OVERRIDE is linked as an ordinary archive (not whole-archive), the linker may only pull in the objects that resolve currently-undefined symbols, so the malloc/free override can silently fail on some platforms or link orders. Consider propagating whole-archive linking (e.g. target_link_options with $<LINK_LIBRARY:WHOLE_ARCHIVE,mimalloc-static>, or linking the benchmark executable with --whole-archive) so the override that the benchmark gains depend on is guaranteed and reproducible.</violation>
</file>

<file name="CMakeLists.txt">

<violation number="1" location="CMakeLists.txt:77">
P3: The new SOURCEMETA_CORE_ALLOCATOR option is declared at the top-level and immediately drives `find_package(Mimalloc REQUIRED)`, but the only target that ever links the resulting library is the benchmark (and benchmarks default OFF). So a user who picks "mimalloc" expecting the core library stack to use it gets nothing changed, while still paying for a full mimalloc configure/build and risking a hard configure failure from the REQUIRED find when only the non-benchmark build is wanted. Consider gating the find_package (and ideally the option's effect) behind SOURCEMATA_CORE_BENCHMARK, and either documenting that the allocator only applies to the benchmark or actually threading the link into the core libraries so the option does what its description says.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread cmake/FindMimalloc.cmake Outdated
if(TARGET mimalloc-static)
set_target_properties(mimalloc-static
PROPERTIES COMPILE_WARNING_AS_ERROR OFF)
add_library(Mimalloc::Mimalloc ALIAS mimalloc-static)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: When a static mimalloc with MI_OVERRIDE is linked as an ordinary archive (not whole-archive), the linker may only pull in the objects that resolve currently-undefined symbols, so the malloc/free override can silently fail on some platforms or link orders. Consider propagating whole-archive linking (e.g. target_link_options with $<LINK_LIBRARY:WHOLE_ARCHIVE,mimalloc-static>, or linking the benchmark executable with --whole-archive) so the override that the benchmark gains depend on is guaranteed and reproducible.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At cmake/FindMimalloc.cmake, line 16:

<comment>When a static mimalloc with MI_OVERRIDE is linked as an ordinary archive (not whole-archive), the linker may only pull in the objects that resolve currently-undefined symbols, so the malloc/free override can silently fail on some platforms or link orders. Consider propagating whole-archive linking (e.g. target_link_options with $<LINK_LIBRARY:WHOLE_ARCHIVE,mimalloc-static>, or linking the benchmark executable with --whole-archive) so the override that the benchmark gains depend on is guaranteed and reproducible.</comment>

<file context>
@@ -0,0 +1,19 @@
+  if(TARGET mimalloc-static)
+    set_target_properties(mimalloc-static
+      PROPERTIES COMPILE_WARNING_AS_ERROR OFF)
+    add_library(Mimalloc::Mimalloc ALIAS mimalloc-static)
+    set(Mimalloc_FOUND ON)
+  endif()
</file context>

Comment thread CMakeLists.txt

# TODO: Turn this into a re-usable utility CMake function
if(SOURCEMETA_CORE_ALLOCATOR STREQUAL "mimalloc")
find_package(Mimalloc REQUIRED)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: The new SOURCEMETA_CORE_ALLOCATOR option is declared at the top-level and immediately drives find_package(Mimalloc REQUIRED), but the only target that ever links the resulting library is the benchmark (and benchmarks default OFF). So a user who picks "mimalloc" expecting the core library stack to use it gets nothing changed, while still paying for a full mimalloc configure/build and risking a hard configure failure from the REQUIRED find when only the non-benchmark build is wanted. Consider gating the find_package (and ideally the option's effect) behind SOURCEMATA_CORE_BENCHMARK, and either documenting that the allocator only applies to the benchmark or actually threading the link into the core libraries so the option does what its description says.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At CMakeLists.txt, line 77:

<comment>The new SOURCEMETA_CORE_ALLOCATOR option is declared at the top-level and immediately drives `find_package(Mimalloc REQUIRED)`, but the only target that ever links the resulting library is the benchmark (and benchmarks default OFF). So a user who picks "mimalloc" expecting the core library stack to use it gets nothing changed, while still paying for a full mimalloc configure/build and risking a hard configure failure from the REQUIRED find when only the non-benchmark build is wanted. Consider gating the find_package (and ideally the option's effect) behind SOURCEMATA_CORE_BENCHMARK, and either documenting that the allocator only applies to the benchmark or actually threading the link into the core libraries so the option does what its description says.</comment>

<file context>
@@ -55,19 +55,29 @@ option(SOURCEMETA_CORE_CONTRIB_GOOGLEBENCHMARK "Build the GoogleBenchmark librar
 
-# TODO: Turn this into a re-usable utility CMake function
+if(SOURCEMETA_CORE_ALLOCATOR STREQUAL "mimalloc")
+  find_package(Mimalloc REQUIRED)
+endif()
+
</file context>

Comment thread .gitignore Outdated
.cache
out/
CMakeSettings.json

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change

Comment thread CMakeLists.txt Outdated
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")

# Options
#Options

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
#Options
# Options

Comment thread CMakeLists.txt Outdated
endif()

# Enable the sanitizers before defining any target
#Enable the sanitizers before defining any target

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like in general most comments lost the initial space for some reason?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes i apologise for the missing spaces, while i was manually reviewing changes i instinctually removed the space out of habit. Im gonna review once again and revert these in the next commit.

Comment thread CMakeLists.txt Outdated
include(Sourcemeta)

# Don't force downstream consumers on this
sourcemeta_option_enum(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If minalloc is indeed consistently faster, then no need to have it as an option. Let's just compile it unconditionally?

Comment thread cmake/FindMimalloc.cmake Outdated
"${MIMALLOC_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}/mimalloc" EXCLUDE_FROM_ALL)

if(TARGET mimalloc-static)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What would happen on shared builds?

@jviotti

jviotti commented Aug 6, 2026

Copy link
Copy Markdown
Member

Very interesting! Given the speed bumps, left some comments about integrating it unconditionally. Probably no need to support multiple allocators. If this one is good, then let's just use it everywhere?

@Vansh-kap-98

Copy link
Copy Markdown
Author

Right now If we link it unconditionally across the whole project, every single DLL will embed its own independent static copy of mimalloc, which causes crashes.

it would work perfectly on unix but to make mimalloc globally override the system allocator on Windows, we will have to use special linking flags, force dynamic overrides, and carefully manage DLLs, so basically there is an extra risk factor

i suggest keeping mimalloc as optional as of right now, while if you want me to, i can work on making it unconditional and submit it as a separate PR in the future.

@jviotti

jviotti commented Aug 8, 2026

Copy link
Copy Markdown
Member

@Vansh-kap-98 What about we make it unconditionally ONLY for Linux to start with, as a first step? So on Linux, it's unconditional. The rest uses the default allocator.

The reason I'm pushing for not having the additional option is that it's a whole other alternate build configuration to maintain, with more additions to the CI matrix, etc. I much rather have a "blessed" configuration all projects operate on.

I tried it on my Mac and its not so easy there (there are caveats just like on Windows), so we can start Linux only, and try future PRs to make it work in the rest?

@Vansh-kap-98

Copy link
Copy Markdown
Author

@jviotti understood, ill remove the "optional" part and integrate it unconditionally for linux for this specific PR

@jviotti

jviotti commented Aug 9, 2026

Copy link
Copy Markdown
Member

Awesome, thanks! Let me know once the changes are made for me to take a look. Excited to land this!

Signed-off-by: Vansh <officialbusiness9818@gmail.com>
@cla-assistant

cla-assistant Bot commented Aug 12, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@cubic-dev-ai cubic-dev-ai Bot 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.

3 issues found across 9 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="patches/mimalloc/0001-Skip-vendored-install-rules-when-embedded.patch">

<violation number="1" location="patches/mimalloc/0001-Skip-vendored-install-rules-when-embedded.patch:11">
P3: The patch guards mimalloc's `install(TARGETS ...)` and `install(EXPORT ...)` rules with `MI_SKIP_INSTALL`, but the vendored CMakeLists still contains unguarded `install(FILES include/mimalloc*.h ...)` and `install(FILES cmake/mimalloc-config*.cmake ...)` rules (vendor/mimalloc/CMakeLists.txt lines 768-774). Since FindMimalloc.cmake sets `MI_SKIP_INSTALL ON` during `add_subdirectory` and then re-registers its own installs of those same headers/config files to the same destinations, `cmake --install` will execute the vendored rules too, installing duplicates of identical files. The guard's stated intent ('skip vendored install rules when embedded') is only partially achieved. Consider extending the guard (or the install trigger) so the vendored `install(FILES ...)` rules are also skipped, leaving a single source of install rules in FindMimalloc.cmake.</violation>
</file>

<file name="cmake/common/targets/library.cmake">

<violation number="1" location="cmake/common/targets/library.cmake:69">
P2: This `sourcemeta_library` helper lives in the shared `cmake/common/` module set used across sourcemeta projects, but it now unconditionally links the raw `mimalloc` / `mimalloc-static` targets on Linux for every library. Those targets only exist because this repo's top-level `CMakeLists.txt` happens to call `find_package(Mimalloc REQUIRED)` and `add_subdirectory(vendor/mimalloc)` first. Any consumer that pulls in these common modules on Linux without first configuring the vendored mimalloc will get a hard configure-time failure (linking a non-existent target), and the allocator now becomes a hard requirement of every library build even where the override is not needed. Consider making the link conditional on the target actually existing (e.g. `if(TARGET mimalloc-static OR TARGET mimalloc)`) or gating it behind a feature flag that this PR can enable, so the shared module stays usable independently.</violation>
</file>

<file name=".gitattributes">

<violation number="1" location=".gitattributes:4">
P3: The diff shows `\ No newline at end of file` after the new `test/test/*.txt text eol=lf` line, and `.gitignore` likewise dropped its trailing blank line and now also ends without a newline. POSIX tools and git generally expect a trailing newline on text files. Add the trailing newline (and keep the removed trailing blank line if it was intentional) to keep the files clean.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic


add_library(${ALIAS_NAME} ALIAS ${TARGET_NAME})

if(SOURCEMETA_OS_LINUX)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: This sourcemeta_library helper lives in the shared cmake/common/ module set used across sourcemeta projects, but it now unconditionally links the raw mimalloc / mimalloc-static targets on Linux for every library. Those targets only exist because this repo's top-level CMakeLists.txt happens to call find_package(Mimalloc REQUIRED) and add_subdirectory(vendor/mimalloc) first. Any consumer that pulls in these common modules on Linux without first configuring the vendored mimalloc will get a hard configure-time failure (linking a non-existent target), and the allocator now becomes a hard requirement of every library build even where the override is not needed. Consider making the link conditional on the target actually existing (e.g. if(TARGET mimalloc-static OR TARGET mimalloc)) or gating it behind a feature flag that this PR can enable, so the shared module stays usable independently.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At cmake/common/targets/library.cmake, line 69:

<comment>This `sourcemeta_library` helper lives in the shared `cmake/common/` module set used across sourcemeta projects, but it now unconditionally links the raw `mimalloc` / `mimalloc-static` targets on Linux for every library. Those targets only exist because this repo's top-level `CMakeLists.txt` happens to call `find_package(Mimalloc REQUIRED)` and `add_subdirectory(vendor/mimalloc)` first. Any consumer that pulls in these common modules on Linux without first configuring the vendored mimalloc will get a hard configure-time failure (linking a non-existent target), and the allocator now becomes a hard requirement of every library build even where the override is not needed. Consider making the link conditional on the target actually existing (e.g. `if(TARGET mimalloc-static OR TARGET mimalloc)`) or gating it behind a feature flag that this PR can enable, so the shared module stays usable independently.</comment>

<file context>
@@ -66,6 +66,27 @@ function(sourcemeta_library)
 
   add_library(${ALIAS_NAME} ALIAS ${TARGET_NAME})
 
+  if(SOURCEMETA_OS_LINUX)
+    if(BUILD_SHARED_LIBS)
+      set(SOURCEMETA_MIMALLOC_LINK_LIBRARY mimalloc)
</file context>

)
- install(TARGETS mimalloc EXPORT mimalloc ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
- install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir})
+ if(NOT MI_SKIP_INSTALL)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: The patch guards mimalloc's install(TARGETS ...) and install(EXPORT ...) rules with MI_SKIP_INSTALL, but the vendored CMakeLists still contains unguarded install(FILES include/mimalloc*.h ...) and install(FILES cmake/mimalloc-config*.cmake ...) rules (vendor/mimalloc/CMakeLists.txt lines 768-774). Since FindMimalloc.cmake sets MI_SKIP_INSTALL ON during add_subdirectory and then re-registers its own installs of those same headers/config files to the same destinations, cmake --install will execute the vendored rules too, installing duplicates of identical files. The guard's stated intent ('skip vendored install rules when embedded') is only partially achieved. Consider extending the guard (or the install trigger) so the vendored install(FILES ...) rules are also skipped, leaving a single source of install rules in FindMimalloc.cmake.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At patches/mimalloc/0001-Skip-vendored-install-rules-when-embedded.patch, line 11:

<comment>The patch guards mimalloc's `install(TARGETS ...)` and `install(EXPORT ...)` rules with `MI_SKIP_INSTALL`, but the vendored CMakeLists still contains unguarded `install(FILES include/mimalloc*.h ...)` and `install(FILES cmake/mimalloc-config*.cmake ...)` rules (vendor/mimalloc/CMakeLists.txt lines 768-774). Since FindMimalloc.cmake sets `MI_SKIP_INSTALL ON` during `add_subdirectory` and then re-registers its own installs of those same headers/config files to the same destinations, `cmake --install` will execute the vendored rules too, installing duplicates of identical files. The guard's stated intent ('skip vendored install rules when embedded') is only partially achieved. Consider extending the guard (or the install trigger) so the vendored `install(FILES ...)` rules are also skipped, leaving a single source of install rules in FindMimalloc.cmake.</comment>

<file context>
@@ -0,0 +1,30 @@
+   )
+-  install(TARGETS mimalloc EXPORT mimalloc ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+-  install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir})
++  if(NOT MI_SKIP_INSTALL)
++    install(TARGETS mimalloc EXPORT mimalloc ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
++    install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir})
</file context>

Comment thread .gitattributes Outdated
/test/yaml/stubs/** -text
vendor/*.mask text eol=lf
*.sh text eol=lf
test/test/*.txt text eol=lf No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: The diff shows \ No newline at end of file after the new test/test/*.txt text eol=lf line, and .gitignore likewise dropped its trailing blank line and now also ends without a newline. POSIX tools and git generally expect a trailing newline on text files. Add the trailing newline (and keep the removed trailing blank line if it was intentional) to keep the files clean.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .gitattributes, line 4:

<comment>The diff shows `\ No newline at end of file` after the new `test/test/*.txt text eol=lf` line, and `.gitignore` likewise dropped its trailing blank line and now also ends without a newline. POSIX tools and git generally expect a trailing newline on text files. Add the trailing newline (and keep the removed trailing blank line if it was intentional) to keep the files clean.</comment>

<file context>
@@ -1,2 +1,4 @@
 /vendor/** linguist-generated=true
 vendor/*.mask text eol=lf
+*.sh text eol=lf
+test/test/*.txt text eol=lf
\ No newline at end of file
</file context>
Suggested change
test/test/*.txt text eol=lf
test/test/*.txt text eol=lf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants