From 547c67a052b0d62dcd5c78cce1dd9268356cf251 Mon Sep 17 00:00:00 2001 From: Michal Srb Date: Jul 23 2019 06:14:55 +0000 Subject: lib/git.py: Recognize git submodules when obtaining patch stats Fixes: UnboundLocalError: local variable 'status' referenced before assignment --- diff --git a/pagure/lib/git.py b/pagure/lib/git.py index 30c927c..1eb493a 100644 --- a/pagure/lib/git.py +++ b/pagure/lib/git.py @@ -2744,8 +2744,9 @@ def get_stats_patch(patch): elif hasattr(patch, "delta"): status = None # Newer pygit2 - # we recognize non-executable file, executable file and symlink - expected_modes = [33188, 33261, 40960] + # we recognize non-executable file, executable file, + # symlink and a special "git submodule" directory + expected_modes = [33188, 33261, 40960, 57344] if ( patch.delta.new_file.mode == 0 and patch.delta.old_file.mode in expected_modes diff --git a/pagure/templates/commit.html b/pagure/templates/commit.html index 484bf49..c3c2bf0 100644 --- a/pagure/templates/commit.html +++ b/pagure/templates/commit.html @@ -17,8 +17,8 @@ {% endblock %} {% block repo %} {% set splitted_message = commit.message.split('\n') %} -{# we recognize non-executable file, executable file and symlink #} -{% set expected_modes = [33188, 33261, 40960] %} +{# we recognize non-executable file, executable file, symlink and a special "git submodule" directory #} +{% set expected_modes = [33188, 33261, 40960, 57344] %}
{% block overviewtabs %}{{ super() }}{% endblock %}