Include: setup.inc

Execute (Ignore untracked file at closed file header):
    call Cd_test_sub()
    Magit
    call Search_file('unstaged')
    call magit#open_close_folding(0)
    call Cursor_position()
    call magit#ignore_file()
    call Cd_test()
    let diff=Git_diff('unstaged', '.gitignore')
    call Expect_diff(g:test_script_dir . 'ignoreFile/ignoreFile_' . Get_safe_filename() . '_ignore_diff.expect', diff)
    call magit#update_buffer()
    Assert (Search_file('unstaged') == 0), $VIMAGIT_TEST_FILENAME . 'should be ignored'
    call search('^modified: .gitignore$')
    call magit#open_close_folding(0)
    call Cursor_position()
    call magit#stage_hunk(1)
    call magit#update_buffer()
    Assert (Search_file('unstaged') != 0), $VIMAGIT_TEST_FILENAME . 'should not be ignored anymore'

Execute (Ignore untracked file at opened file header):
    call Cd_test_sub()
    Magit
    call Search_file('unstaged')
    call magit#open_close_folding(1)
    call Cursor_position()
    call magit#ignore_file()
    call Cd_test()
    let diff=Git_diff('unstaged', '.gitignore')
    call Expect_diff(g:test_script_dir . 'ignoreFile/ignoreFile_' . Get_safe_filename() . '_ignore_diff.expect', diff)
    call magit#update_buffer()
    Assert (Search_file('unstaged') == 0), $VIMAGIT_TEST_FILENAME . 'should be ignored'
    call search('^modified: .gitignore$')
    call magit#open_close_folding(1)
    call Cursor_position()
    call magit#stage_hunk(1)
    call magit#update_buffer()
    Assert (Search_file('unstaged') != 0), $VIMAGIT_TEST_FILENAME . 'should not be ignored anymore'

Execute (Ignore untracked file at hunk position):
    call Cd_test_sub()
    Magit
    call Search_file('unstaged')
    call magit#open_close_folding(1)
    call Move_relative(+1)
    call Cursor_position()
    call magit#ignore_file()
    call Cd_test()
    let diff=Git_diff('unstaged', '.gitignore')
    call Expect_diff(g:test_script_dir . 'ignoreFile/ignoreFile_' . Get_safe_filename() . '_ignore_diff.expect', diff)
    call magit#update_buffer()
    Assert (Search_file('unstaged') == 0), $VIMAGIT_TEST_FILENAME . 'should be ignored'
    call search('^modified: .gitignore$')
    call magit#open_close_folding(1)
    call Move_relative(+1)
    call Cursor_position()
    call magit#stage_hunk(1)
    call magit#update_buffer()
    Assert (Search_file('unstaged') != 0), $VIMAGIT_TEST_FILENAME . 'should not be ignored anymore'



Include: cleanup.inc
