summaryrefslogtreecommitdiff
path: root/git/test/test_docs.py
blob: 5ebae51360d2e2ec212533d1622d57d96f29c740 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#-*-coding:utf-8-*-
# test_git.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import os

import git
from git.test.lib import TestBase
from gitdb.test.lib import with_rw_directory
from git.repo.fun import touch


class TestGit(TestBase):

    @with_rw_directory
    def test_add_file_and_commit(self, rw_dir):
        repo_dir = os.path.join(rw_dir, 'my-new-repo')
        file_name = os.path.join(repo_dir, 'new-file')

        r = git.Repo.init(repo_dir)
        # This function just creates an empty file ...
        touch(file_name)
        r.index.add([file_name])
        r.index.commit("initial commit")