summaryrefslogtreecommitdiff
path: root/git/index
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2015-01-21 18:56:29 +0100
committerSebastian Thiel <byronimo@gmail.com>2015-01-21 18:57:34 +0100
commitd565a874f29701531ce1fc0779592838040d3edf (patch)
treec2ba9a69ae90eedc01616b409a179baf705a3feb /git/index
parente4d3809161fc54d6913c0c2c7f6a7b51eebe223f (diff)
downloadgitpython-d565a874f29701531ce1fc0779592838040d3edf.tar.gz
Fixed regression in test-suite for IndexFile
Previously, it checked for AssertionErrors, now we have to implement need-unbare-repo check ourselves.
Diffstat (limited to 'git/index')
-rw-r--r--git/index/base.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/git/index/base.py b/git/index/base.py
index 7002385c..b73edd6f 100644
--- a/git/index/base.py
+++ b/git/index/base.py
@@ -27,7 +27,8 @@ from .util import (
import git.diff as diff
from git.exc import (
GitCommandError,
- CheckoutError
+ CheckoutError,
+ InvalidGitRepositoryError
)
from git.objects import (
@@ -54,6 +55,7 @@ from git.util import (
join_path_native,
file_contents_ro,
to_native_path_linux,
+ unbare_repo
)
from .fun import (
@@ -346,6 +348,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
return index
# UTILITIES
+ @unbare_repo
def _iter_expand_paths(self, paths):
"""Expand the directories in list of paths to the corresponding paths accordingly,
@@ -536,6 +539,8 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
if it is not within our git direcotory"""
if not os.path.isabs(path):
return path
+ if self.repo.bare:
+ raise InvalidGitRepositoryError("require non-bare repository")
relative_path = path.replace(self.repo.working_tree_dir + os.sep, "")
if relative_path == path:
raise ValueError("Absolute path %r is not in git repository at %r" % (path, self.repo.working_tree_dir))
@@ -575,6 +580,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
return BaseIndexEntry((stat_mode_to_index_mode(st.st_mode),
istream.binsha, 0, to_native_path_linux(filepath)))
+ @unbare_repo
@git_working_dir
def _entries_for_paths(self, paths, path_rewriter, fprogress, entries):
entries_added = list()