From 06c9c919707ba4116442ca53ac7cf035540981f2 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 11 Sep 2016 18:30:21 +0200 Subject: fix(Head): checkout() handles detached head It's not optimal, as we can now return one of two types which are only compatible in the most basic ways. However, it is better than before, I presume. Fixes #510 --- git/test/test_refs.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'git/test/test_refs.py') diff --git a/git/test/test_refs.py b/git/test/test_refs.py index 879b8caa..9816fb50 100644 --- a/git/test/test_refs.py +++ b/git/test/test_refs.py @@ -175,6 +175,12 @@ class TestRefs(TestBase): def test_orig_head(self): assert type(self.rorepo.head.orig_head()) == SymbolicReference + + @with_rw_repo('0.1.6') + def test_head_checkout_detached_head(self, rw_repo): + res = rw_repo.remotes.origin.refs.master.checkout() + assert isinstance(res, SymbolicReference) + assert res.name == 'HEAD' @with_rw_repo('0.1.6') def test_head_reset(self, rw_repo): -- cgit v1.2.1