{% extends "repository/repository.html" %} {% block page_title %}Commit: {{ commit.id }}{% endblock %} {% block content %}
Author {{ commit.author }} {{ commit_time(commit.author.time, commit.author.offset) }}
Committer {{ commit.committer }} {{ commit_time(commit.committer.time, commit.committer.offset) }}
Commit ID {{ commit.id }}
Tree {{ commit.tree.id }}
Parent(s) {% for parent in commit.parents %} {{ parent.short_id }} {% endfor %}
± {{ diff.stats.files_changed }} files changed, {{ diff.stats.insertions }} insertions, {{ diff.stats.deletions }} deletions
{{ commit.message }}
Diff options
View
Context lines
Inter-hunk lines
Side
Whitespace
{% for patch in diff %} {# The following status values are defined in the git_delta_t enum # in libgit2. See https://github.com/libgit2/libgit2/blob/main/include/git2/diff.h # 0 = UNCHANGED # 1 = ADDED (does not exist in old version) # 2 = DELETED (does not exist in new version) # 3 = MODIFIED (content changed between old and new versions) # 4 = RENAMED # 5 = COPIED # ... (there are other codes that we don't use) #} {% if patch.delta.is_binary %} {% endif %} {% for hunk in patch.hunks if not patch.delta.is_binary %} {#### UDIFF mode ####} {% if mode == 'udiff' %} {% for line in hunk.lines %} {% endfor %} {% endif %} {#### SSDIFF mode ####} {% if mode == 'ssdiff' %} {% macro print_buffer(buffer_deletions, buffer_insertions) %} {% for buffer_del, buffer_ins in zip_longest(buffer_deletions, buffer_insertions) %} {% if buffer_del %} {% else %} {% endif %} {% if buffer_ins %} {% else %} {% endif %} {% endfor %} {# .clear() empties the buffer. However since it requires # {{}} brackets instead of {%%}, this line will print the # value of "buffer_deletions" which is "None". # "or ''" is a hack for printing an empty line instead of "None". #} {{ buffer_deletions.clear() or '' }} {{ buffer_insertions.clear() or '' }} {% endmacro %} {% set buffer_deletions = [] %} {% set buffer_insertions = [] %} {% for line in hunk.lines %} {% if line.old_lineno < 0 %} {{ buffer_insertions.append(line) or '' }} {% endif %} {% if line.new_lineno < 0 %} {{ buffer_deletions.append(line) or '' }} {% endif %} {% if line.old_lineno >= 0 and line.new_lineno >= 0 %} {# Unload buffer #} {{ print_buffer(buffer_deletions, buffer_insertions) }} {% endif %} {% endfor %} {# Empty remaining buffer #} {{ print_buffer(buffer_deletions, buffer_insertions) }} {% endif %} {% endfor %}
-{{ patch.line_stats[2] }}/+{{ patch.line_stats[1] }} {% if patch.delta.status == 1 %} A {{ patch.delta.new_file.path }} {% endif %} {% if patch.delta.status == 2 %} D {{ patch.delta.old_file.path }} {% endif %} {% if patch.delta.status == 3 %} M {{ patch.delta.new_file.path }} {% endif %} {% if patch.delta.status == 4 %} R {{ patch.delta.old_file.path }} -> {{ patch.delta.new_file.path }} {% endif %} {% if patch.delta.status == 5 %} C {{ patch.delta.old_file.path }} {{ patch.delta.new_file.path }} {% endif %}
old size: {{ patch.delta.old_file.size|human_size(B=true) }} - new size: {{ patch.delta.new_file.size|human_size(B=true) }}
{% if patch.delta.status == 1 %} new file mode: {{ patch.delta.new_file.mode|filemode }} {% elif patch.delta.status == 2 %} deleted file mode: {{ patch.delta.old_file.mode|filemode }} {% elif patch.delta.old_file.mode != patch.delta.new_file.mode %} old mode: {{ patch.delta.old_file.mode|filemode }}
new mode: {{ patch.delta.new_file.mode|filemode }} {% endif %}
Binary file
{{ hunk.header }}
{% if line.old_lineno >= 0 %} {{ line.old_lineno }} {% endif %} {% if line.new_lineno >= 0 %} {{ line.new_lineno }} {% endif %} {{ line.origin }} {{ line.content }}
{{ buffer_del.old_lineno }} {{ buffer_del.content }} {{ buffer_ins.new_lineno }} {{ buffer_ins.content }}
{{ hunk.header }}
{{ line.old_lineno }} {{ line.content }} {{ line.new_lineno }} {{ line.content }}
{% endfor %}
{% endblock %}