From 7a320abc52307b4d4010166bd899ac75024ec9a7 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 18 Nov 2010 09:20:15 +0100 Subject: commit: when creating a new commit and advancing the head, it will now write the ORIG_HEAD reference as well --- lib/git/objects/commit.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/git/objects/commit.py') diff --git a/lib/git/objects/commit.py b/lib/git/objects/commit.py index ae22fb76..1aedaabf 100644 --- a/lib/git/objects/commit.py +++ b/lib/git/objects/commit.py @@ -365,7 +365,13 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): new_commit.binsha = istream.binsha if head: + # need late import here, importing git at the very beginning throws + # as well ... + import git.refs try: + cur_commit = repo.head.commit + # Adjust the original head reference - force it + git.refs.SymbolicReference.create(repo, 'ORIG_HEAD', cur_commit, force=True) repo.head.commit = new_commit except ValueError: # head is not yet set to the ref our HEAD points to -- cgit v1.2.1