summaryrefslogtreecommitdiffstats
path: root/g2h/git.py
diff options
context:
space:
mode:
Diffstat (limited to 'g2h/git.py')
-rw-r--r--g2h/git.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/g2h/git.py b/g2h/git.py
new file mode 100644
index 0000000..e6984c4
--- /dev/null
+++ b/g2h/git.py
@@ -0,0 +1,11 @@
+import git
+
+class Git:
+ def __init__(self, repo_path):
+ try:
+ self.repo = git.Repo(repo_path)
+ except git.InvalidGitRepositoryError:
+ raise ValueError(f"Invalid git repository at {repo_path}")
+
+ def get_all_commits(self):
+ return list(self.repo.iter_commits())