summaryrefslogtreecommitdiff
path: root/git/repo/base.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2011-01-17 20:41:20 +0100
committerSebastian Thiel <byronimo@gmail.com>2011-01-17 20:41:20 +0100
commit031271e890327f631068571a3f79235a35a4f73e (patch)
tree768e3f6457cce186168658c2daf0e2ec6b55f9ff /git/repo/base.py
parentb4b50e7348815402634b6b559b48191dba00a751 (diff)
downloadgitpython-031271e890327f631068571a3f79235a35a4f73e.tar.gz
git.repo.base: substituted all usages of the active_branch property with self.head.* in order to more safely get the current commit. active_branch would only work on non-detached heads
Diffstat (limited to 'git/repo/base.py')
-rw-r--r--git/repo/base.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/git/repo/base.py b/git/repo/base.py
index e26da101..0405a5f9 100644
--- a/git/repo/base.py
+++ b/git/repo/base.py
@@ -368,7 +368,7 @@ class Repo(object):
:param rev: revision specifier, see git-rev-parse for viable options.
:return: ``git.Commit``"""
if rev is None:
- return self.active_branch.commit
+ return self.head.commit
else:
return self.rev_parse(str(rev)+"^0")
@@ -391,7 +391,7 @@ class Repo(object):
it cannot know about its path relative to the repository root and subsequent
operations might have unexpected results."""
if rev is None:
- return self.active_branch.commit.tree
+ return self.head.commit.tree
else:
return self.rev_parse(str(rev)+"^{tree}")
@@ -415,7 +415,7 @@ class Repo(object):
:return ``git.Commit[]``"""
if rev is None:
- rev = self.active_branch
+ rev = self.head.commit
return Commit.iter_items(self, rev, paths, **kwargs)
@@ -739,7 +739,7 @@ class Repo(object):
:raise GitCommandError: in case something went wrong
:return: self"""
if treeish is None:
- treeish = self.active_branch
+ treeish = self.head.commit
if prefix and 'prefix' not in kwargs:
kwargs['prefix'] = prefix
kwargs['output_stream'] = ostream