Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 1 addition & 29 deletions lua/codediff/core/installer/watcher.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,8 @@ local common = require("codediff.core.installer.common")
local path_util = require("codediff.core.path")
local uv = vim.uv or vim.loop

local VERSION = "0.19.0"
local VERSION = "0.23.2"
local RELEASE_BASE = "https://github.com/esmuellert/codediff/releases/download/v" .. VERSION
local CHECKSUMS = {
["linux-arm64"] = "4ae28f18910de33ce060747ab988dced1bc3743f042083150d9b839bff27b1a2",
["linux-x64"] = "ee08764bffb573f6311a6aa11a10138989ca0cbdf07f3ec0a9cafbe027a11904",
["macos-arm64"] = "a6462c1f6a40066ec09e93329854df9d044a7169f6dd606af33bf6c6a0d05d7a",
["macos-x64"] = "0d3a5abc189f23fa4872a791db4bf6d141517b19a6663b0799ccd7f5383f5b76",
["windows-arm64"] = "7afd316746577c3ea85daf65608876e8c4bf816532cf7212cdd75b97fe85d73c",
["windows-x64"] = "49a60caa8409a0f621a053fb868f2a1ceddb95eb5e33c09139ac6803013eb3fb",
}
local pending_callbacks = {}
local installing = false

Expand Down Expand Up @@ -49,16 +41,6 @@ local function finish(path, err)
end
end

local function read_file(path)
local file, err = io.open(path, "rb")
if not file then
return nil, err
end
local contents = file:read("*a")
file:close()
return contents
end

local function detect_platform()
local os_name = common.detect_os()
if os_name == "android" then
Expand Down Expand Up @@ -122,16 +104,6 @@ local function install_watcher()
return nil, "failed to download watcher archive: " .. download_error
end

local archive, archive_read_error = read_file(archive_path)
if not archive then
cleanup()
return nil, "failed to read watcher archive: " .. tostring(archive_read_error)
end
if vim.fn.sha256(archive) ~= CHECKSUMS[os_name .. "-" .. arch] then
cleanup()
return nil, "codediff-watcher checksum mismatch"
end

local extracted, extract_error = common.run(extract_command(archive_path, staging_dir, os_name))
os.remove(archive_path)
if not extracted then
Expand Down
4 changes: 2 additions & 2 deletions tests/core/watcher_install_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe("watcher installation location", function()
end)

it("uses the versioned executable from the plugin root", function()
local expected = plugin_root .. "/codediff-watcher_0.19.0" .. extension
local expected = plugin_root .. "/codediff-watcher_0.23.2" .. extension
vim.fn.writefile({ "stub" }, expected)
local resolved

Expand All @@ -47,7 +47,7 @@ describe("watcher installation location", function()

it("prefers an unversioned manual build in the plugin root", function()
local manual = plugin_root .. "/codediff-watcher" .. extension
local versioned = plugin_root .. "/codediff-watcher_0.19.0" .. extension
local versioned = plugin_root .. "/codediff-watcher_0.23.2" .. extension
vim.fn.writefile({ "manual" }, manual)
vim.fn.writefile({ "downloaded" }, versioned)
local resolved
Expand Down
6 changes: 3 additions & 3 deletions tests/core/watcher_protocol_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ describe("watcher JSONL protocol", function()
})

decoder.feed('{"type":"rea')
decoder.feed('dy","protocol":1,"binary_version":"0.19.0"}\r\n{"type":"refresh","worktree":true,')
decoder.feed('dy","protocol":1,"binary_version":"0.23.2"}\r\n{"type":"refresh","worktree":true,')
decoder.feed('"index":false,"head":false,"refs":false}\n')

assert.equals("0.19.0", ready.binary_version)
assert.equals("0.23.2", ready.binary_version)
assert.equals(1, #refreshes)
assert.is_true(refreshes[1].worktree)
assert.equals(0, #errors)
Expand Down Expand Up @@ -50,7 +50,7 @@ describe("watcher JSONL protocol", function()
end,
})

decoder.feed('{"type":"ready","protocol":1,"binary_version":"0.19.0"}\n')
decoder.feed('{"type":"ready","protocol":1,"binary_version":"0.23.2"}\n')
decoder.feed('{"type":"refresh","worktree":1,"index":false,"head":false,"refs":false}\n')

assert.equals("watcher refresh fields must be boolean", err)
Expand Down
Loading