From 2df9a31b600d8703c9b3ce759b685151c8937196 Mon Sep 17 00:00:00 2001 From: Adam Waldenberg Date: Wed, 10 Jul 2013 14:23:11 +0200 Subject: [PATCH] gitinspector now finds the absolute path of the git directory. If gitinspector was not executed standing in the root directory of the git repository (or with a git root specified at the command line), "git ls-tree" would not find all files properly. --- gitinspector/gitinspector.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gitinspector/gitinspector.py b/gitinspector/gitinspector.py index ce89038..378b339 100755 --- a/gitinspector/gitinspector.py +++ b/gitinspector/gitinspector.py @@ -38,6 +38,7 @@ import os import optval import outputable import responsibilities +import subprocess import sys import terminal import timeline @@ -52,7 +53,11 @@ class Runner: terminal.skip_escapes(not sys.stdout.isatty()) terminal.set_stdout_encoding() previous_directory = os.getcwd() + os.chdir(self.repo) + absolute_path = subprocess.Popen("git rev-parse --show-toplevel", shell=True, bufsize=1, + stdout=subprocess.PIPE).stdout + os.chdir(absolute_path.readlines()[0].decode("utf-8", "replace").strip()) if not format.select(self.opts.format): raise format.InvalidFormatError(_("specified output format not supported."))