From 6ecf1d655271b263e3b5f73e8d4575acf3bfdbf8 Mon Sep 17 00:00:00 2001 From: Luka Hietala Date: Wed, 19 Nov 2025 17:21:25 +0200 Subject: [PATCH] rename all hash to id --- app.py | 6 +++--- git/commit.py | 6 +++--- templates/blob.html | 2 +- templates/commit.html | 2 +- templates/commits.html | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app.py b/app.py index bd06a08..3b87e76 100644 --- a/app.py +++ b/app.py @@ -30,9 +30,9 @@ def repo_commits(repo_name): has_prev = page > 0 return render_template("commits.html", repo_name=repo_name, commits=commits, page=page, has_next=has_next, has_prev=has_prev, ref=ref) -@app.route("//commits/") -def commit_detail(repo_name, commit_hash): - commit = get_commit(f"{repo_path}/{repo_name}", commit_hash) +@app.route("//commits/") +def commit_detail(repo_name, commit_id): + commit = get_commit(f"{repo_path}/{repo_name}", commit_id) return render_template("commit.html", repo_name=repo_name, commit=commit) @app.route("//refs") diff --git a/git/commit.py b/git/commit.py index 7fe001f..1c13bf5 100644 --- a/git/commit.py +++ b/git/commit.py @@ -43,10 +43,10 @@ def get_commits(path, ref="HEAD", max_count=None, skip=0): n += 1 return commits -# retrieves a single commit by its hash -def get_commit(path, commit_hash): +# retrieves a single commit by its id +def get_commit(path, commit_id): repo = git.Repository(path) - commit = repo.revparse_single(commit_hash) + commit = repo.revparse_single(commit_id) if len(commit.parents) > 0: diff = repo.diff(commit.parents[0], commit) diff --git a/templates/blob.html b/templates/blob.html index 72352fc..d80ae27 100644 --- a/templates/blob.html +++ b/templates/blob.html @@ -1,6 +1,6 @@ {% block content %}

Blob: {{ blob.name }}

-

Blob hash: {{ blob.id }}

+

Blob id: {{ blob.id }}

Size: {{ blob.size }} bytes

Content:

{% if blob.is_binary %} diff --git a/templates/commit.html b/templates/commit.html index af298ae..cec9e77 100644 --- a/templates/commit.html +++ b/templates/commit.html @@ -5,7 +5,7 @@

Committer: {{ commit.committer.name }} <{{ commit.committer.email }}>

Date: {{ commit.date }}

{% if commit.parent_id %} -

Parent: {{ commit.parent_id }}

+

Parent: {{ commit.parent_id }}

{% endif %}

Tree: {{ commit.tree_id }}

View Tree

diff --git a/templates/commits.html b/templates/commits.html index e9ba28a..d766dc6 100644 --- a/templates/commits.html +++ b/templates/commits.html @@ -4,7 +4,7 @@
    {% for commit in commits %}
  • - {{ commit.id }} - {{ commit.message }} - {{ commit.author.name }} - {{ commit.date }} {{ commit.diff_stats.files_changed }} files changed, {{ commit.diff_stats.insertions }} insertions, {{ commit.diff_stats.deletions }} deletions + {{ commit.id }} - {{ commit.message }} - {{ commit.author.name }} - {{ commit.date }} {{ commit.diff_stats.files_changed }} files changed, {{ commit.diff_stats.insertions }} insertions, {{ commit.diff_stats.deletions }} deletions
  • {% endfor %}
-- 2.47.3