From ca9ef60edeb3fe44549140a9da6982578fde0e5c Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Fri, 9 Aug 2024 19:41:19 -0400 Subject: [PATCH] feat: Add GitRepo.get_head() method --- aider/repo.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/aider/repo.py b/aider/repo.py index f17ae101b..cefb12fca 100644 --- a/aider/repo.py +++ b/aider/repo.py @@ -356,3 +356,9 @@ class GitRepo: return True return self.repo.is_dirty(path=path) + + def get_head(self): + try: + return self.repo.head.commit.hexsha + except ValueError: + return None