Esempio n. 1
0
    def test_branch_default_remote(self):
        fwrite(branch_test_worktree_p, ".git", "gitdir: ../branch_test_git")

        g = Git(GitOpt(), cwd=branch_test_worktree_p)
        cases = [
            ('master', 'origin'),
            ('dev', 'upstream'),
            ('not_a_branch', None),
        ]

        for branch, remote in cases:
            got = g.branch_default_remote(branch)
            self.assertEqual(remote, got)
Esempio n. 2
0
    def test_branch_default_remote(self):
        # branch_test_git_p is a git-dir with one commit::
        # * 1d5ae3d (HEAD, origin/master, master) A  a

        # write a ".git" file to specify the git-dir for the containing
        # git-work-tree.
        fwrite(branch_test_worktree_p, ".git", "gitdir: ../branch_test_git")

        g = Git(GitOpt(), cwd=branch_test_worktree_p)
        cases = [
            ('master', 'origin'),
            ('dev', 'upstream'),
            ('not_a_branch', None),
        ]

        for branch, remote in cases:
            got = g.branch_default_remote(branch)
            self.assertEqual(remote, got)