From 9129bb04cac1b1d7dc0d6dca7bca77d2ee6c5187 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 18 Jul 2026 14:59:32 +0200 Subject: [PATCH] test(pack): "vim.pack" tests fail on local machine --- test/functional/plugin/pack_spec.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/functional/plugin/pack_spec.lua b/test/functional/plugin/pack_spec.lua index 4fab031db8..6faed91a09 100644 --- a/test/functional/plugin/pack_spec.lua +++ b/test/functional/plugin/pack_spec.lua @@ -98,7 +98,9 @@ local function git_get_hash(rev, repo_name) end local function git_get_short_hash(rev, repo_name) - return git_cmd({ 'rev-list', '-1', '--abbrev-commit', rev }, repo_name) + -- Pin `--abbrev`. Git's default abbrev differs across environments, which would shift the + -- hard-coded column alignment and LSP link positions in the confirmation-buffer tests. + return git_cmd({ 'rev-list', '-1', '--abbrev=7', '--abbrev-commit', rev }, repo_name) end -- Common test repos ---------------------------------------------------------- @@ -1172,6 +1174,13 @@ describe('vim.pack', function() }) n.clear() + -- Pin git's short-hash length so the confirmation buffer's `%h` columns are deterministic. + exec_lua([[ + vim.env.GIT_CONFIG_COUNT = '1' + vim.env.GIT_CONFIG_KEY_0 = 'core.abbrev' + vim.env.GIT_CONFIG_VALUE_0 = '7' + ]]) + -- Mock remote repo update -- - Force push repo_write_file('fetch', 'lua/fetch.lua', 'return "fetch new"')