~edwargix/git.sr.ht

4e04d5ba973752013871e56d07711d8d4dfa28db — Solomon Victorino 3 years ago 98040e0
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)
3 files changed, 3 insertions(+), 3 deletions(-)

M gitsrht/blueprints/repo.py
M gitsrht/git.py
M gitsrht/rss.py
M gitsrht/blueprints/repo.py => gitsrht/blueprints/repo.py +1 -1
@@ 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]

M gitsrht/git.py => gitsrht/git.py +1 -1
@@ 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))

M gitsrht/rss.py => gitsrht/rss.py +1 -1
@@ 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", "<br />")