diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2009-12-03 16:31:07 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2009-12-03 16:31:07 +0100 |
commit | c05ef0e7543c2845fd431420509476537fefe2b0 (patch) | |
tree | 75393ae080690acd035108d698d3c5a467076ebb /lib/git/index.py | |
parent | 1eae9d1532e037a4eb08aaee79ff3233d2737f31 (diff) | |
download | gitpython-c05ef0e7543c2845fd431420509476537fefe2b0.tar.gz |
repo: renamed directories to more descriptive identifiers and made them safer to use in case of bare repositories
Diffstat (limited to 'lib/git/index.py')
-rw-r--r-- | lib/git/index.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/git/index.py b/lib/git/index.py index 9effd3cd..3c895a78 100644 --- a/lib/git/index.py +++ b/lib/git/index.py @@ -325,7 +325,7 @@ class IndexFile(LazyMixin, diff.Diffable): super(IndexFile, self)._set_cache_(attr) def _index_path(self): - return join_path_native(self.repo.path, "index") + return join_path_native(self.repo.git_dir, "index") @property @@ -539,7 +539,7 @@ class IndexFile(LazyMixin, diff.Diffable): # tmp file created in git home directory to be sure renaming # works - /tmp/ dirs could be on another device - tmp_index = tempfile.mktemp('','',repo.path) + tmp_index = tempfile.mktemp('','',repo.git_dir) arg_list.append("--index-output=%s" % tmp_index) arg_list.extend(treeish) @@ -547,7 +547,7 @@ class IndexFile(LazyMixin, diff.Diffable): # as it considers existing entries. moving it essentially clears the index. # Unfortunately there is no 'soft' way to do it. # The _TemporaryFileSwap assure the original file get put back - index_handler = _TemporaryFileSwap(join_path_native(repo.path, 'index')) + index_handler = _TemporaryFileSwap(join_path_native(repo.git_dir, 'index')) try: repo.git.read_tree(*arg_list, **kwargs) index = cls(repo, tmp_index) @@ -579,7 +579,7 @@ class IndexFile(LazyMixin, diff.Diffable): return ret - # UTILITIES + # UTILITIES def _iter_expand_paths(self, paths): """Expand the directories in list of paths to the corresponding paths accordingly, @@ -588,7 +588,7 @@ class IndexFile(LazyMixin, diff.Diffable): times - we respect that and do not prune""" def raise_exc(e): raise e - r = self.repo.git.git_dir + r = self.repo.working_tree_dir rs = r + '/' for path in paths: abs_path = path @@ -798,9 +798,9 @@ class IndexFile(LazyMixin, diff.Diffable): """ if not os.path.isabs(path): return path - relative_path = path.replace(self.repo.git.git_dir+os.sep, "") + 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.git.git_dir)) + raise ValueError("Absolute path %r is not in git repository at %r" % (path,self.repo.working_tree_dir)) return relative_path def _preprocess_add_items(self, items): |