def test_adding_something_with_conflict(temp_git_dir):
    with temp_git_dir.as_cwd():
        temp_git_dir.join('f.py').write("print('hello world')")
        cmd_output('git', 'add', 'f.py')
        temp_git_dir.join('F.py').write("print('hello world')")
        cmd_output('git', 'add', 'F.py')

        assert find_conflicting_filenames(['f.py', 'F.py']) == 1
def test_adding_something_with_conflict(temp_git_dir):
    with local.cwd(temp_git_dir):
        write_file('f.py', "print('hello world')")
        local['git']('add', 'f.py')
        write_file('F.py', "print('hello world')")
        local['git']('add', 'F.py')

        assert find_conflicting_filenames(['f.py', 'F.py']) == 1
def test_file_conflicts_with_committed_file(temp_git_dir):
    with local.cwd(temp_git_dir):
        write_file('f.py', "print('hello world')")
        local['git']('add', 'f.py')
        local['git']('commit', '--no-verify', '-m', 'Add f.py')

        write_file('F.py', "print('hello world')")
        local['git']('add', 'F.py')

        assert find_conflicting_filenames(['F.py']) == 1
def test_file_conflicts_with_committed_file(temp_git_dir):
    with temp_git_dir.as_cwd():
        temp_git_dir.join('f.py').write("print('hello world')")
        cmd_output('git', 'add', 'f.py')
        cmd_output('git', 'commit', '--no-gpg-sign', '-n', '-m', 'Add f.py')

        temp_git_dir.join('F.py').write("print('hello world')")
        cmd_output('git', 'add', 'F.py')

        assert find_conflicting_filenames(['F.py']) == 1
def test_added_file_not_in_pre_commits_list(temp_git_dir):
    with local.cwd(temp_git_dir):
        write_file('f.py', "print('hello world')")
        local['git']('add', 'f.py')

        assert find_conflicting_filenames(['g.py']) == 0
def test_nothing_added(temp_git_dir):
    with local.cwd(temp_git_dir):
        assert find_conflicting_filenames(['f.py']) == 0
def test_added_file_not_in_pre_commits_list(temp_git_dir):
    with temp_git_dir.as_cwd():
        temp_git_dir.join('f.py').write("print('hello world')")
        cmd_output('git', 'add', 'f.py')

        assert find_conflicting_filenames(['g.py']) == 0
def test_adding_something(temp_git_dir):
    with temp_git_dir.as_cwd():
        temp_git_dir.join('f.py').write("print('hello world')")
        cmd_output('git', 'add', 'f.py')

        assert find_conflicting_filenames(['f.py']) == 0
def test_added_file_not_in_pre_commits_list(temp_git_dir):
    with cwd(temp_git_dir):
        write_file('f.py', "print('hello world')")
        cmd_output('git', 'add', 'f.py')

        assert find_conflicting_filenames(['g.py']) == 0
def test_adding_something(temp_git_dir):
    with cwd(temp_git_dir):
        write_file('f.py', "print('hello world')")
        cmd_output('git', 'add', 'f.py')

        assert find_conflicting_filenames(['f.py']) == 0
def test_nothing_added(temp_git_dir):
    with cwd(temp_git_dir):
        assert find_conflicting_filenames(['f.py']) == 0