diff --git a/git/commit.py b/git/commit.py
index ba70b8c..7fe001f 100644
--- a/git/commit.py
+++ b/git/commit.py
'author': commit.author,
'committer': commit.committer,
'tree_id': str(commit.tree.id),
+ 'parent_id': str(commit.parents[0].id) if commit.parents else None,
'date': commit.commit_time,
'diff_stats': diff_stats,
'diff': diff.patch if diff else None
diff --git a/templates/commit.html b/templates/commit.html
index c95a0d8..af298ae 100644
--- a/templates/commit.html
+++ b/templates/commit.html
<p>Author: {{ commit.author.name }} <{{ commit.author.email }}></p>
<p>Committer: {{ commit.committer.name }} <{{ commit.committer.email }}></p>
<p>Date: {{ commit.date }}</p>
+ {% if commit.parent_id %}
+ <p>Parent: <a href="{{ url_for('commit_detail', repo_name=repo_name, commit_hash=commit.parent_id) }}">{{ commit.parent_id }}</a></p>
+ {% endif %}
<p>Tree: <a href="{{ url_for('repo_tree_path', repo_name=repo_name, path='') }}?ref={{ commit.tree_id }}">{{ commit.tree_id }}</a></p>
<p><a href="{{ url_for('repo_tree_path', repo_name=repo_name, path='') }}?ref={{ commit.id }}">View Tree</a></p>
+ {% if commit.diff %}
<h2>Diff Stats</h2>
<ul>
<li>Files Changed: {{ commit.diff_stats.files_changed }}</li>
<li>Insertions: {{ commit.diff_stats.insertions }}</li>
<li>Deletions: {{ commit.diff_stats.deletions }}</li>
</ul>
+ {% endif %}
<h2>Diff</h2>
+ {% if commit.diff %}
<pre>{{ commit.diff }}</pre>
+ {% else %}
+ <p>No changes compared to parent</p>
+ {% endif %}
{% endblock %}
\ No newline at end of file