@@ -3423,6 +3423,42 @@ describe('commands', function()
34233423 return repo_root
34243424 end
34253425
3426+ local function create_binary_review_repo (opts )
3427+ opts = opts or {}
3428+ local repo_root = vim .fn .tempname ()
3429+ vim .fn .mkdir (repo_root , ' p' )
3430+ test_repos [# test_repos + 1 ] = repo_root
3431+
3432+ vim .fn .systemlist ({ ' git' , ' init' , ' -q' , repo_root })
3433+ assert .are .equal (0 , vim .v .shell_error )
3434+ git_cmd (repo_root , { ' config' , ' user.email' , ' test@example.com' })
3435+ git_cmd (repo_root , { ' config' , ' user.name' , ' Test' })
3436+
3437+ write_repo_file (repo_root , ' aaa-one.lua' , { ' old one' })
3438+ write_binary_file (repo_root .. ' /bbb-bin.dat' , ' binary\\ 000old' )
3439+ if opts .trailing ~= false then
3440+ write_repo_file (repo_root , ' ccc-two.lua' , { ' old two' })
3441+ git_cmd (repo_root , { ' add' , ' aaa-one.lua' , ' bbb-bin.dat' , ' ccc-two.lua' })
3442+ else
3443+ git_cmd (repo_root , { ' add' , ' aaa-one.lua' , ' bbb-bin.dat' })
3444+ end
3445+ git_cmd (repo_root , { ' commit' , ' -qm' , ' base' })
3446+ git_cmd (repo_root , { ' branch' , ' binary-base' })
3447+
3448+ git_cmd (repo_root , { ' checkout' , ' -qb' , ' binary-topic' })
3449+ write_repo_file (repo_root , ' aaa-one.lua' , { ' new one' })
3450+ write_binary_file (repo_root .. ' /bbb-bin.dat' , ' binary\\ 000new' )
3451+ if opts .trailing ~= false then
3452+ write_repo_file (repo_root , ' ccc-two.lua' , { ' new two' })
3453+ git_cmd (repo_root , { ' add' , ' aaa-one.lua' , ' bbb-bin.dat' , ' ccc-two.lua' })
3454+ else
3455+ git_cmd (repo_root , { ' add' , ' aaa-one.lua' , ' bbb-bin.dat' })
3456+ end
3457+ git_cmd (repo_root , { ' commit' , ' -qm' , ' target' })
3458+
3459+ return repo_root
3460+ end
3461+
34263462 it (' opens review layout split as exactly two visible surfaces' , function ()
34273463 local repo_root = create_repo ()
34283464 vim .fn .writefile ({ ' line 1' , ' line 2 changed' }, repo_root .. ' /file.txt' )
@@ -3719,6 +3755,72 @@ describe('commands', function()
37193755 assert_target_at_hunk (panes , 1 )
37203756 end )
37213757
3758+ it (' skips unsupported files when switching review files' , function ()
3759+ local repo_root = create_binary_review_repo ()
3760+ edit_file (repo_root .. ' /aaa-one.lua' )
3761+ local notifications = capture_notifications ()
3762+ mock_runtime_attach (function () end )
3763+
3764+ local left_buf = commands .review_command (' ++layout=split binary-base..binary-topic' )
3765+ local panes = track_panes (left_buf )
3766+ assert .are .same (
3767+ diffspec .rev_to_rev (' binary-base' , ' binary-topic' , ' aaa-one.lua' ),
3768+ vim .api .nvim_buf_get_var (panes .left_buf , ' diffs_spec' )
3769+ )
3770+
3771+ vim .api .nvim_set_current_win (panes .right_win )
3772+ commands .review_next_file ()
3773+ panes = track_panes (panes .state .left_buf )
3774+ assert .are .same (
3775+ diffspec .rev_to_rev (' binary-base' , ' binary-topic' , ' ccc-two.lua' ),
3776+ vim .api .nvim_buf_get_var (panes .left_buf , ' diffs_spec' )
3777+ )
3778+ assert .are .equal (vim .log .levels .INFO , notifications [# notifications ].level )
3779+ assert .are .equal (
3780+ ' [diffs]: review skipped 1 file(s): bbb-bin.dat' ,
3781+ notifications [# notifications ].message
3782+ )
3783+
3784+ vim .api .nvim_set_current_win (panes .right_win )
3785+ commands .review_prev_file ()
3786+ panes = track_panes (panes .state .left_buf )
3787+ assert .are .same (
3788+ diffspec .rev_to_rev (' binary-base' , ' binary-topic' , ' aaa-one.lua' ),
3789+ vim .api .nvim_buf_get_var (panes .left_buf , ' diffs_spec' )
3790+ )
3791+ assert .are .equal (vim .log .levels .INFO , notifications [# notifications ].level )
3792+ assert .are .equal (
3793+ ' [diffs]: review skipped 1 file(s): bbb-bin.dat' ,
3794+ notifications [# notifications ].message
3795+ )
3796+ end )
3797+
3798+ it (' keeps the skipped-file message when no candidate switches' , function ()
3799+ local repo_root = create_binary_review_repo ({ trailing = false })
3800+ edit_file (repo_root .. ' /aaa-one.lua' )
3801+ local notifications = capture_notifications ()
3802+ mock_runtime_attach (function () end )
3803+
3804+ local left_buf = commands .review_command (' ++layout=split binary-base..binary-topic' )
3805+ local panes = track_panes (left_buf )
3806+ assert .are .same (
3807+ diffspec .rev_to_rev (' binary-base' , ' binary-topic' , ' aaa-one.lua' ),
3808+ vim .api .nvim_buf_get_var (panes .left_buf , ' diffs_spec' )
3809+ )
3810+
3811+ vim .api .nvim_set_current_win (panes .right_win )
3812+ commands .review_next_file ()
3813+ panes = track_panes (panes .state .left_buf )
3814+
3815+ assert .are .same (
3816+ diffspec .rev_to_rev (' binary-base' , ' binary-topic' , ' aaa-one.lua' ),
3817+ vim .api .nvim_buf_get_var (panes .left_buf , ' diffs_spec' )
3818+ )
3819+ assert .are .equal (1 , # notifications )
3820+ assert .are .equal (vim .log .levels .INFO , notifications [1 ].level )
3821+ assert .are .equal (' [diffs]: review skipped 1 file(s): bbb-bin.dat' , notifications [1 ].message )
3822+ end )
3823+
37223824 it (' exposes review_files/current/goto, the gO map, and the b:diffs_review marker' , function ()
37233825 local repo = create_review_repo ()
37243826 edit_file (repo .repo_root .. ' /lua/one.lua' )
0 commit comments