From 4e04d5ba973752013871e56d07711d8d4dfa28db Mon Sep 17 00:00:00 2001 From: Solomon Victorino Date: Sat, 29 May 2021 13:31:02 -0700 Subject: [PATCH] Show commit date instead of modified date for tags - Display the original commit date in /refs and the RSS feature. - Fix the RSS feed's sort order (/refs sort is correct) --- gitsrht/blueprints/repo.py | 2 +- gitsrht/git.py | 2 +- gitsrht/rss.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gitsrht/blueprints/repo.py b/gitsrht/blueprints/repo.py index 31bc848..49e4f58 100644 --- a/gitsrht/blueprints/repo.py +++ b/gitsrht/blueprints/repo.py @@ -560,7 +560,7 @@ def refs_rss(owner, repo): def _ref_sort_key(ref): target = git_repo.get(ref.target) - author = target.author if hasattr(target, 'author') else target.tagger + author = target.author if hasattr(target, 'author') else target.get_object().author return author.time + author.offset references = sorted(references, key=_ref_sort_key, reverse=True)[:20] diff --git a/gitsrht/git.py b/gitsrht/git.py index 1ccd909..9d7b77e 100644 --- a/gitsrht/git.py +++ b/gitsrht/git.py @@ -12,7 +12,7 @@ def trim_commit(msg): return msg[:msg.index("\n")] def commit_time(commit): - author = commit.author if hasattr(commit, 'author') else commit.tagger + author = commit.author if hasattr(commit, 'author') else commit.get_object().author # Time handling in python is so dumb try: tzinfo = timezone(timedelta(minutes=author.offset)) diff --git a/gitsrht/rss.py b/gitsrht/rss.py index 9716af8..fe46e63 100644 --- a/gitsrht/rss.py +++ b/gitsrht/rss.py @@ -45,7 +45,7 @@ def ref_to_item(repo, reference): with GitRepository(repo.path) as git_repo: target = git_repo.get(reference.target) - author = target.author if hasattr(target, 'author') else target.tagger + author = target.author if hasattr(target, 'author') else target.get_object().author time = aware_time(author).strftime(RFC_822_FORMAT) url = ref_url(repo, reference) description = target.message.strip().replace("\n", "
") -- 2.38.4