summaryrefslogtreecommitdiff
path: root/lib/git
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-11-18 09:20:15 +0100
committerSebastian Thiel <byronimo@gmail.com>2010-11-18 09:23:32 +0100
commit7a320abc52307b4d4010166bd899ac75024ec9a7 (patch)
tree4bcf41d016ca85dc49e4ab8e77971db105a00d89 /lib/git
parent1687283c13caf7ff8d1959591541dff6a171ca1e (diff)
downloadgitpython-7a320abc52307b4d4010166bd899ac75024ec9a7.tar.gz
commit: when creating a new commit and advancing the head, it will now write the ORIG_HEAD reference as well
Diffstat (limited to 'lib/git')
-rw-r--r--lib/git/objects/commit.py6
-rw-r--r--lib/git/refs.py2
2 files changed, 7 insertions, 1 deletions
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
diff --git a/lib/git/refs.py b/lib/git/refs.py
index 39c5ff29..399c4b78 100644
--- a/lib/git/refs.py
+++ b/lib/git/refs.py
@@ -277,7 +277,7 @@ class SymbolicReference(object):
@classmethod
def to_full_path(cls, path):
"""
- :return: string with a full path name which can be used to initialize
+ :return: string with a full repository-relative path which can be used to initialize
a Reference instance, for instance by using ``Reference.from_path``"""
if isinstance(path, SymbolicReference):
path = path.path