Skip to content

Commit

Permalink
Merge pull request #8 from zschreur/zschreur/push-vmkqntnllvwo
Browse files Browse the repository at this point in the history
Fix conflicts so that it works when there are less than 3 spaces
  • Loading branch information
zschreur authored May 29, 2024
2 parents 87c7194 + f02d304 commit f3a109e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lua/telescope-jj/conflicts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ return function(opts)
local results = {}
for _, str in ipairs(cmd_output) do
-- https://github.com/martinvonz/jj/blob/9a5b001d58353afb7ea6cb894c22d80878b811ae/cli/src/cli_util.rs#L1778
local word = string.match(str, "^(.-)%s%s%s")
local word = string.match(str, "^(.-)%s+%a+%-sided conflict$")
table.insert(results, word)
end

Expand Down
12 changes: 12 additions & 0 deletions lua/telescope-jj/conflicts.test.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
local s1 = "file two-sided conflict"
local s2 = "file two-sided conflict"
local s3 = "file two-sided conflict"
local s4 = "file three-sided conflict"
local s5 = "file two-sided conflict two-sided conflict"

local pattern = "^(.-)%s+%a+%-sided conflict$"
assert(string.match(s1, pattern) == "file")
assert(string.match(s2, pattern) == "file")
assert(string.match(s3, pattern) == "file")
assert(string.match(s4, pattern) == "file")
assert(string.match(s5, pattern) == "file two-sided conflict")

0 comments on commit f3a109e

Please sign in to comment.