Skip to content

Commit ece804a

Browse files
Arthur-MilchiorByron
authored andcommitted
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.
1 parent d5cc590 commit ece804a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Diff for: AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@ Contributors are:
3333
-Steven Whitman <ninloot _at_ gmail.com>
3434
-Stefan Stancu <stefan.stancu _at_ gmail.com>
3535
-César Izurieta <cesar _at_ caih.org>
36+
-Arthur Milchior <arthur _at_ milchior.fr>
3637

3738
Portions derived from other open source works and are clearly marked.

Diff for: git/repo/base.py

+11
Original file line numberDiff line numberDiff line change
@@ -1062,3 +1062,14 @@ def has_separate_working_tree(self):
10621062

10631063
def __repr__(self):
10641064
return '<git.Repo "%s">' % self.git_dir
1065+
1066+
def currentlyRebasingOn(self):
1067+
"""
1068+
:return: The hash of the commit which is currently being replayed while rebasing.
1069+
1070+
None if we are not currently rebasing.
1071+
"""
1072+
rebase_head_file = osp.join(self.git_dir, "REBASE_HEAD")
1073+
if not osp.isfile(rebase_head_file):
1074+
return None
1075+
return open(rebase_head_file, "rt").readline().strip()

0 commit comments

Comments
 (0)