summaryrefslogtreecommitdiff
path: root/lib/git
diff options
context:
space:
mode:
Diffstat (limited to 'lib/git')
-rw-r--r--lib/git/index.py8
-rw-r--r--lib/git/repo.py9
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/git/index.py b/lib/git/index.py
index 5f13790c..5452708d 100644
--- a/lib/git/index.py
+++ b/lib/git/index.py
@@ -289,7 +289,8 @@ class IndexFile(LazyMixin, diff.Diffable):
``file_path``
If None, we will write to our stored file path from which we have
been initialized. Otherwise we write to the given file path.
- Please note that this will not change the file_path of this index.
+ Please note that this will change the file_path of this index to
+ the one you gave.
Returns
self
@@ -319,7 +320,10 @@ class IndexFile(LazyMixin, diff.Diffable):
# write the sha over the content
stream.write_sha()
write_op._end_writing()
-
+
+ # make sure we represent what we have written
+ if file_path is not None:
+ self._file_path = file_path
@classmethod
def from_tree(cls, repo, *treeish, **kwargs):
diff --git a/lib/git/repo.py b/lib/git/repo.py
index 94555a31..569d6f1b 100644
--- a/lib/git/repo.py
+++ b/lib/git/repo.py
@@ -14,6 +14,7 @@ from errors import InvalidGitRepositoryError, NoSuchPathError
from cmd import Git
from actor import Actor
from refs import *
+from index import IndexFile
from objects import *
from config import GitConfigParser
from remote import Remote
@@ -145,6 +146,14 @@ class Repo(object):
# alias heads
branches = heads
+
+ @property
+ def index(self):
+ """
+ Returns
+ IndexFile representing this repository's index.
+ """
+ return IndexFile(self)
@property
def head(self):