From b02d1303b80f18f482b9eee94f1f29245c9da69f Mon Sep 17 00:00:00 2001 From: Justin Mayhew Date: Tue, 24 Mar 2026 14:23:17 -0300 Subject: [PATCH] fix(pack): add trailing newline to lockfile #38469 Problem: JSON files should end with a trailing newline so that Unix tools work as expected, Git doesn't report "No newline at end of file" and to avoid noise in diffs from editors and other tools adding the missing newline. Solution: Add trailing newline. --- runtime/lua/vim/pack.lua | 2 +- test/functional/plugin/pack_spec.lua | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/lua/vim/pack.lua b/runtime/lua/vim/pack.lua index a218a38d6a..0a4058be56 100644 --- a/runtime/lua/vim/pack.lua +++ b/runtime/lua/vim/pack.lua @@ -819,7 +819,7 @@ local function lock_write() local fd = assert(uv.fs_open(path, 'w', 438)) local data = vim.json.encode(lock, { indent = ' ', sort_keys = true }) - assert(uv.fs_write(fd, data)) + assert(uv.fs_write(fd, data .. '\n')) assert(uv.fs_close(fd)) end diff --git a/test/functional/plugin/pack_spec.lua b/test/functional/plugin/pack_spec.lua index 484be65f3c..88fbdbe047 100644 --- a/test/functional/plugin/pack_spec.lua +++ b/test/functional/plugin/pack_spec.lua @@ -574,7 +574,8 @@ describe('vim.pack', function() "version": ">=0.0.0" } } - }]]):format( + } + ]]):format( basic_rev, repos_src.basic, defbranch_rev,