Diff between 541b68ec1c5e2883838cab75a4424b71644b73e0 and b9b2fe3f354b731c8556009920e281054161910f

Changed Files

File Additions Deletions Status
git/commit.py +1 -0 modified
templates/commit.html +9 -0 modified

Full Patch

diff --git a/git/commit.py b/git/commit.py
index ba70b8c..7fe001f 100644
--- a/git/commit.py
+++ b/git/commit.py
@@ -70,6 +70,7 @@ def get_commit(path, commit_hash):
         '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
@@ -4,14 +4,23 @@
     <p>Author: {{ commit.author.name }} &lt;{{ commit.author.email }}&gt;</p>
     <p>Committer: {{ commit.committer.name }} &lt;{{ commit.committer.email }}&gt;</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