diff options
-rw-r--r-- | git/diff.py | 11 | ||||
-rw-r--r-- | git/index/fun.py | 2 | ||||
-rw-r--r-- | git/repo/base.py | 9 | ||||
-rw-r--r-- | git/test/test_diff.py | 2 |
4 files changed, 20 insertions, 4 deletions
diff --git a/git/diff.py b/git/diff.py index 76426940..44a65017 100644 --- a/git/diff.py +++ b/git/diff.py @@ -333,7 +333,16 @@ class Diff(object): @property def renamed(self): - """:returns: True if the blob of our diff has been renamed""" + """:returns: True if the blob of our diff has been renamed + :note: This property is deprecated, please use ``renamed_file`` instead. + """ + return self.renamed_file + + @property + def renamed_file(self): + """:returns: True if the blob of our diff has been renamed + :note: This property is deprecated, please use ``renamed_file`` instead. + """ return self.rename_from != self.rename_to @classmethod diff --git a/git/index/fun.py b/git/index/fun.py index c1026fd6..4dd32b19 100644 --- a/git/index/fun.py +++ b/git/index/fun.py @@ -93,7 +93,7 @@ def stat_mode_to_index_mode(mode): return S_IFLNK if S_ISDIR(mode) or S_IFMT(mode) == S_IFGITLINK: # submodules return S_IFGITLINK - return S_IFREG | 0o644 | (mode & 0o100) # blobs with or without executable bit + return S_IFREG | 0o644 | (mode & 0o111) # blobs with or without executable bit def write_cache(entries, stream, extension_data=None, ShaStreamCls=IndexFileSHA1Writer): diff --git a/git/repo/base.py b/git/repo/base.py index 0274c0a7..c2bd2a62 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -254,7 +254,9 @@ class Repo(object): @property def index(self): - """:return: IndexFile representing this repository's index.""" + """:return: IndexFile representing this repository's index. + :note: This property can be expensive, as the returned ``IndexFile`` will be + reinitialized. It's recommended to re-use the object.""" return IndexFile(self) @property @@ -624,7 +626,10 @@ class Repo(object): are relative to the current working directory of the git command. :note: - ignored files will not appear here, i.e. files mentioned in .gitignore""" + ignored files will not appear here, i.e. files mentioned in .gitignore + :note: + This property is expensive, as no cache is involved. To process the result, please + consider caching it yourself.""" return self._get_untracked_files() def _get_untracked_files(self, **kwargs): diff --git a/git/test/test_diff.py b/git/test/test_diff.py index 858b3994..1d7a4fda 100644 --- a/git/test/test_diff.py +++ b/git/test/test_diff.py @@ -86,6 +86,7 @@ class TestDiff(TestBase): assert_equal(1, len(diffs)) diff = diffs[0] + assert_true(diff.renamed_file) assert_true(diff.renamed) assert_equal(diff.rename_from, u'Jérôme') assert_equal(diff.rename_to, u'müller') @@ -95,6 +96,7 @@ class TestDiff(TestBase): diffs = Diff._index_from_raw_format(self.rorepo, output.stdout) assert len(diffs) == 1 diff = diffs[0] + assert diff.renamed_file assert diff.renamed assert diff.rename_from == 'this' assert diff.rename_to == 'that' |