From e7671110bc865786ffe61cf9b92bf43c03759229 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 12 Jan 2015 12:25:53 +0100 Subject: Removed os.path.realpath invocations as they are not necessary if paths are used consistently. This will save IOPs, and make the code easier to understand (I suppose). Related to #224 --- git/index/base.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'git/index') diff --git a/git/index/base.py b/git/index/base.py index 66fd5b1f..db0c3cda 100644 --- a/git/index/base.py +++ b/git/index/base.py @@ -579,8 +579,14 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): entries_added = list() if path_rewriter: for path in paths: - abspath = os.path.abspath(path) - gitrelative_path = abspath[len(self.repo.working_tree_dir) + 1:] + if os.path.isabs(path): + abspath = path + gitrelative_path = path[len(self.repo.working_tree_dir) + 1:] + else: + gitrelative_path = path + abspath = os.path.join(self.repo.working_tree_dir, gitrelative_path) + # end obtain relative and absolute paths + blob = Blob(self.repo, Blob.NULL_BIN_SHA, stat_mode_to_index_mode(os.stat(abspath).st_mode), to_native_path_linux(gitrelative_path)) -- cgit v1.2.1