From 956b1c786826941041b6b12da9d867c2cb26b8b0 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sat, 19 Jan 2019 14:11:40 -0800 Subject: [PATCH] cmds: use version.check_git(...) in OpenParent Check the git version before attempting to use git rev-parse --show-superproject-working-tree. Signed-off-by: David Aguilar --- cola/cmds.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cola/cmds.py b/cola/cmds.py index 28713085..b17e7aa2 100644 --- a/cola/cmds.py +++ b/cola/cmds.py @@ -18,6 +18,7 @@ from . import icons from . import resources from . import textwrap from . import utils +from . import version from .cmd import ContextCommand from .diffparse import DiffParser from .git import STDOUT @@ -1521,12 +1522,15 @@ class OpenRepo(EditModel): class OpenParentRepo(OpenRepo): def __init__(self, context): - status, path, _ = context.git.rev_parse( - show_superproject_working_tree=True) - if status == 0 and path: - super(OpenParentRepo, self).__init__(context, path) - else: - super(OpenParentRepo, self).__init__(context, '') + path = '' + if version.check_git(context, 'show-superproject-working-tree'): + status, out, _ = context.git.rev_parse( + show_superproject_working_tree=True) + if status == 0: + path = out + if not path: + path = os.path.dirname(core.getcwd()) + super(OpenParentRepo, self).__init__(context, path) class Clone(ContextCommand): -- 2.11.4.GIT