From 5c061cbb0a11e68cc36def504d8d74c10c255df0 Mon Sep 17 00:00:00 2001 From: Tamir Bahar <tmr232@users.noreply.github.com> Date: Tue, 3 Jan 2017 01:17:48 +0200 Subject: [PATCH] Remove unused code Removed a chunk of code from `checkout` that did nothing, but had a bug. When checking out from a branch-less state (like the state when a repository is first initialized) the code failed. The failure was due to trying to get some properties of the current branch, which were never used in the code. --- pygit2/repository.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pygit2/repository.py b/pygit2/repository.py index aeeb981..0386914 100644 --- a/pygit2/repository.py +++ b/pygit2/repository.py @@ -279,11 +279,6 @@ class Repository(_Repository): oid = reference.resolve().target treeish = self[oid] self.checkout_tree(treeish, **kwargs) - head = self.lookup_reference('HEAD') - if head.type == C.GIT_REF_SYMBOLIC: - from_ = self.head.shorthand - else: - from_ = head.target.hex self.set_head(refname)