File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,38 +4,16 @@ local function diffview_open(args)
44 vim .cmd (" DiffviewOpen " .. table.concat (args , " " ))
55end
66
7- local function diffview_history (args )
8- vim .cmd (" DiffviewFileHistory " .. table.concat (args , " " ))
9- end
10-
11- function M .show_selected (hashes , indices )
7+ function M .show_selected (hashes , _ )
128 if # hashes == 0 then
139 vim .notify (" No commits selected" , vim .log .levels .INFO )
1410 return
1511 end
1612
17- local is_consecutive = true
18- if # indices > 1 then
19- for i = 2 , # indices do
20- if indices [i ] ~= indices [i - 1 ] + 1 then
21- is_consecutive = false
22- break
23- end
24- end
25- end
26-
27- if is_consecutive then
28- if # hashes == 1 then
29- diffview_open ({ hashes [1 ] .. " ^.." .. hashes [1 ] })
30- else
31- diffview_open ({ hashes [# hashes ] .. " ^.." .. hashes [1 ] })
32- end
13+ if # hashes == 1 then
14+ diffview_open ({ hashes [1 ] .. " ^.." .. hashes [1 ] })
3315 else
34- local args = { " --no-walk" }
35- for _ , h in ipairs (hashes ) do
36- table.insert (args , h )
37- end
38- diffview_history (args )
16+ diffview_open ({ hashes [# hashes ] .. " ^.." .. hashes [1 ] })
3917 end
4018end
4119
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ T["actions"]["show_selected() handles non-consecutive commits correctly"] = func
4646 end
4747
4848 actions .show_selected ({ " newer123" , " older789" }, { 1 , 3 })
49- MiniTest .expect .equality (cmds [1 ], " DiffviewFileHistory --no-walk newer123 older789" )
49+ MiniTest .expect .equality (cmds [1 ], " DiffviewOpen older789^..newer123 " )
5050end
5151
5252T [" log" ] = MiniTest .new_set ()
You can’t perform that action at this time.
0 commit comments