summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Schlosser <christoph@linux.com>2025-08-24 17:14:49 +0200
committerChristoph Schlosser <christoph@linux.com>2025-08-24 17:14:49 +0200
commit8f2f0d5d1176794bb7df2c42c54b7211e155d331 (patch)
treeaf828007405c5a4e657188af3eccdad2f10f609b
parent9bd3fd1bce788dce610ad7276ce1f1634019c380 (diff)
downloadgit2hugo-8f2f0d5d1176794bb7df2c42c54b7211e155d331.tar.gz
g2h: Turn the git class into a simple wrapping frontend
-rw-r--r--g2h/cli.py4
-rw-r--r--g2h/git.py4
-rw-r--r--test_repo/git.tgzbin16230 -> 16230 bytes
3 files changed, 4 insertions, 4 deletions
diff --git a/g2h/cli.py b/g2h/cli.py
index 3beaeb2..1391ec2 100644
--- a/g2h/cli.py
+++ b/g2h/cli.py
@@ -19,11 +19,11 @@ def main():
args = parse_args()
git = Git(args.repo_path)
- branches = git.get_branches()
+ branches = sorted(git.get_branches(), key=lambda b: b.commit.committed_date, reverse=True)
commits = git.get_commits()
# TODO: Fix this for repo_path=(.|~)
project_name = args.name if args.name is not None else os.path.basename(args.repo_path)
- tags = git.get_tags()
+ tags = sorted(git.get_tags(), key=lambda t: t.commit.committed_date, reverse=True)
factory = PageFactory(args.out_dir, project_name)
factory.new_overview(branches, tags).render()
diff --git a/g2h/git.py b/g2h/git.py
index f3f4809..079c50b 100644
--- a/g2h/git.py
+++ b/g2h/git.py
@@ -8,10 +8,10 @@ class Git:
raise ValueError(f"Invalid git repository at {repo_path}")
def get_branches(self):
- return sorted(self.repo.branches, key=lambda b: b.commit.committed_date, reverse=True)
+ return self.repo.branches
def get_commits(self):
return list(self.repo.iter_commits())
def get_tags(self):
- return sorted(self.repo.tags, key=lambda b: b.commit.committed_date, reverse=True)
+ return self.repo.tags
diff --git a/test_repo/git.tgz b/test_repo/git.tgz
index 16afa55..3c96007 100644
--- a/test_repo/git.tgz
+++ b/test_repo/git.tgz
Binary files differ