Example #1
0
def test_fetch_creates_refs(filesystem):
    client_1 = filesystem / 'client_1'
    client_2 = filesystem / 'client_2'

    util.make_file(client_1 / 'foo.txt')
    _git.add(client_1, 'foo.txt')
    _git.commit(client_1, 'Committing...')
    _git.push(client_1, 'origin', 'master')

    _git.fetch(client_2, 'origin')
    assert _git.has_ref(client_2, 'refs/remotes/origin/master')
    assert not (client_2 / 'foo.txt').exists()
Example #2
0
def test_ref_exists(filesystem):
    client_1 = filesystem / 'client_1'
    assert not _git.has_ref(client_1, 'refs/heads/master')
    assert not _git.has_ref(client_1, 'refs/remotes/origin/master')

    util.make_file(client_1 / 'foo.txt')
    _git.add(client_1, 'foo.txt')
    assert not _git.has_ref(client_1, 'refs/heads/master')

    _git.commit(client_1, 'Committing...')
    assert _git.has_ref(client_1, 'refs/heads/master')

    _git.push(client_1, 'origin', 'master')
    assert _git.has_ref(client_1, 'refs/remotes/origin/master')

    _git.fetch(client_1, 'origin')
    assert _git.has_ref(client_1, 'refs/remotes/origin/master')