Skip to content

Commit 3cbc1cf

Browse files
committed
Merge restore_head() feature into autofill-fix
2 parents 3412b7d + 93baaac commit 3cbc1cf

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

git-imerge

+5-6
Original file line numberDiff line numberDiff line change
@@ -320,12 +320,7 @@ class GitTemporaryHead(object):
320320
def __exit__(self, exc_type, exc_val, exc_tb):
321321
if self.head_name:
322322
try:
323-
check_call([
324-
'git', 'symbolic-ref',
325-
'-m', self.message, 'HEAD',
326-
self.head_name,
327-
])
328-
check_call(['git', 'reset', '--hard'])
323+
self.git.restore_head(self.head_name, self.message)
329324
except CalledProcessError as e:
330325
raise Failure(
331326
'Could not restore HEAD to %r!: %s\n'
@@ -992,6 +987,10 @@ class GitRepository(object):
992987
except CalledProcessError:
993988
return None
994989

990+
def restore_head(self, refname, message):
991+
check_call(['git', 'symbolic-ref', '-m', message, 'HEAD', refname])
992+
check_call(['git', 'reset', '--hard'])
993+
995994
def checkout(self, refname, quiet=False):
996995
cmd = ['git', 'checkout']
997996
if quiet:

0 commit comments

Comments
 (0)