From 15e441f1720e49db0fb75ab1105710e540d37445 Mon Sep 17 00:00:00 2001 From: Romain Failliot Date: Fri, 8 Jul 2016 23:00:58 -0400 Subject: [PATCH] [svn merge][r424] Added support for Git submodules. --- ChangeLog | 1 + src/usr/bin/diffuse | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3c27c15..8fb4da7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +- add support for Git submodules - added Akom Chotiphantawanon's Thai translation - updated Python highlighting for Python 3 grammar - added a preference and command line option to specify the version control system search order diff --git a/src/usr/bin/diffuse b/src/usr/bin/diffuse index a10f355..c396a36 100755 --- a/src/usr/bin/diffuse +++ b/src/usr/bin/diffuse @@ -1861,7 +1861,7 @@ class _Git: def getFolderTemplate(self, prefs, names): # build command - args = [ prefs.getString('git_bin'), 'status', '--porcelain', '-s', '--untracked-files=no' ] + args = [ prefs.getString('git_bin'), 'status', '--porcelain', '-s', '--untracked-files=no', '--ignore-submodules=all' ] # build list of interesting files pwd, isabs = os.path.abspath(os.curdir), False for name in names: @@ -1963,9 +1963,15 @@ def _get_git_repo(path, prefs): except (IOError, OSError, WindowsError): # working tree not found pass - p = _find_parent_dir_with(path, '.git') - if p: - return _Git(p) + # search for .git direcotry (project) or .git file (submodule) + while True: + name = os.path.join(path, '.git') + if os.path.isdir(name) or os.path.isfile(name): + return _Git(path) + newpath = os.path.dirname(path) + if newpath == path: + break + path = newpath # Mercurial support class _Hg: