summaryrefslogtreecommitdiff
path: root/git/repo
diff options
context:
space:
mode:
authorArthur Milchior <Arthur@Milchior.fr>2019-08-05 12:33:54 +0200
committerSebastian Thiel <byronimo@gmail.com>2019-08-14 17:57:00 +0800
commitece804aed9874b4fd1f6b4f4c40268e919a12b17 (patch)
tree615e3495420d0845bba7a5e87ddc7dc324438936 /git/repo
parentd5cc590c875ada0c55d975cbe26141a94e306c94 (diff)
downloadgitpython-ece804aed9874b4fd1f6b4f4c40268e919a12b17.tar.gz
Method stating which commit is being played during an halted rebase
This will be useful to me at least. This way, I know that I can tell my script to omit some specific commits. If you accept to merge it, I may also do similar method for merges and cherry pick.
Diffstat (limited to 'git/repo')
-rw-r--r--git/repo/base.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/git/repo/base.py b/git/repo/base.py
index 1df3c547..efb70b37 100644
--- a/git/repo/base.py
+++ b/git/repo/base.py
@@ -1062,3 +1062,14 @@ class Repo(object):
def __repr__(self):
return '<git.Repo "%s">' % self.git_dir
+
+ def currentlyRebasingOn(self):
+ """
+ :return: The hash of the commit which is currently being replayed while rebasing.
+
+ None if we are not currently rebasing.
+ """
+ rebase_head_file = osp.join(self.git_dir, "REBASE_HEAD")
+ if not osp.isfile(rebase_head_file):
+ return None
+ return open(rebase_head_file, "rt").readline().strip()