{% for group_key, group in groups.items() %} {% if group.count > 0 %} {% set should_show = (group_key == 'unstaged' and unstaged) or (group_key == 'untracked' and untracked) or (group_key == 'staged') or (group_key == 'changes') %}
{% set hide_header = (group_key == 'staged' and not unstaged and not untracked) or (group_key == 'changes' and not untracked) %} {% if not hide_header %}

{{ group_key|title }}

{{ group.count }} files
{% endif %}
{% for file in group.files %} {% set group_name = group_key %} {% include "diff_file.html" with context %} {% endfor %}
{% endif %} {% endfor %}