aboutsummaryrefslogtreecommitdiff
path: root/git/index
diff options
context:
space:
mode:
Diffstat (limited to 'git/index')
-rw-r--r--git/index/base.py13
-rw-r--r--git/index/fun.py2
-rw-r--r--git/index/util.py11
3 files changed, 14 insertions, 12 deletions
diff --git a/git/index/base.py b/git/index/base.py
index 9b6d28ab..ac2d3019 100644
--- a/git/index/base.py
+++ b/git/index/base.py
@@ -170,7 +170,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
def _deserialize(self, stream):
"""Initialize this instance with index values read from the given stream"""
- self.version, self.entries, self._extension_data, conten_sha = read_cache(stream)
+ self.version, self.entries, self._extension_data, conten_sha = read_cache(stream) # @UnusedVariable
return self
def _entries_sorted(self):
@@ -404,7 +404,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
continue
# END glob handling
try:
- for root, dirs, files in os.walk(abs_path, onerror=raise_exc):
+ for root, dirs, files in os.walk(abs_path, onerror=raise_exc): # @UnusedVariable
for rela_file in files:
# add relative paths only
yield os.path.join(root.replace(rs, ''), rela_file)
@@ -599,7 +599,6 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
"""Store file at filepath in the database and return the base index entry
Needs the git_working_dir decorator active ! This must be assured in the calling code"""
st = os.lstat(filepath) # handles non-symlinks as well
- stream = None
if S_ISLNK(st.st_mode):
# in PY3, readlink is string, but we need bytes. In PY2, it's just OS encoded bytes, we assume UTF-8
open_stream = lambda: BytesIO(force_bytes(os.readlink(filepath), encoding=defenc))
@@ -1102,11 +1101,11 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
try:
self.entries[(co_path, 0)]
except KeyError:
- dir = co_path
- if not dir.endswith('/'):
- dir += '/'
+ folder = co_path
+ if not folder.endswith('/'):
+ folder += '/'
for entry in mviter(self.entries):
- if entry.path.startswith(dir):
+ if entry.path.startswith(folder):
p = entry.path
self._write_path_to_stdin(proc, p, p, make_exc,
fprogress, read_from_stdout=False)
diff --git a/git/index/fun.py b/git/index/fun.py
index 74ac929e..7a7593fe 100644
--- a/git/index/fun.py
+++ b/git/index/fun.py
@@ -264,7 +264,7 @@ def write_tree_from_cache(entries, odb, sl, si=0):
# enter recursion
# ci - 1 as we want to count our current item as well
- sha, tree_entry_list = write_tree_from_cache(entries, odb, slice(ci - 1, xi), rbound + 1)
+ sha, tree_entry_list = write_tree_from_cache(entries, odb, slice(ci - 1, xi), rbound + 1) # @UnusedVariable
tree_items_append((sha, S_IFDIR, base))
# skip ahead
diff --git a/git/index/util.py b/git/index/util.py
index 0340500c..ce798851 100644
--- a/git/index/util.py
+++ b/git/index/util.py
@@ -2,6 +2,9 @@
import struct
import tempfile
import os
+
+from functools import wraps
+
from git.compat import is_win
__all__ = ('TemporaryFileSwap', 'post_clear_cache', 'default_index', 'git_working_dir')
@@ -48,13 +51,13 @@ def post_clear_cache(func):
natively which in fact is possible, but probably not feasible performance wise.
"""
+ @wraps(func)
def post_clear_cache_if_not_raised(self, *args, **kwargs):
rval = func(self, *args, **kwargs)
self._delete_entries_cache()
return rval
-
# END wrapper method
- post_clear_cache_if_not_raised.__name__ = func.__name__
+
return post_clear_cache_if_not_raised
@@ -63,6 +66,7 @@ def default_index(func):
repository index. This is as we rely on git commands that operate
on that index only. """
+ @wraps(func)
def check_default_index(self, *args, **kwargs):
if self._file_path != self._index_path():
raise AssertionError(
@@ -70,7 +74,6 @@ def default_index(func):
return func(self, *args, **kwargs)
# END wrpaper method
- check_default_index.__name__ = func.__name__
return check_default_index
@@ -78,6 +81,7 @@ def git_working_dir(func):
"""Decorator which changes the current working dir to the one of the git
repository in order to assure relative paths are handled correctly"""
+ @wraps(func)
def set_git_working_dir(self, *args, **kwargs):
cur_wd = os.getcwd()
os.chdir(self.repo.working_tree_dir)
@@ -88,7 +92,6 @@ def git_working_dir(func):
# END handle working dir
# END wrapper
- set_git_working_dir.__name__ = func.__name__
return set_git_working_dir
#} END decorators