diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-11-23 22:47:34 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-11-23 22:47:34 +0100 |
commit | 61f3db7bd07ac2f3c2ff54615c13bf9219289932 (patch) | |
tree | 3074927bc62c3b4e1473d24e787836d0dfb3fa21 /refs/symbolic.py | |
parent | a21a9f6f13861ddc65671b278e93cf0984adaa30 (diff) | |
download | gitpython-61f3db7bd07ac2f3c2ff54615c13bf9219289932.tar.gz |
Removed ORIG_HEAD handling which was downright wrong. ORIG_HEAD gets only set during merge and rebase, and probably everything that changes the ref more drastically. Probably I have to reread that. What needs to be adjusted though is the reflog
Diffstat (limited to 'refs/symbolic.py')
-rw-r--r-- | refs/symbolic.py | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/refs/symbolic.py b/refs/symbolic.py index b978e484..94e8d726 100644 --- a/refs/symbolic.py +++ b/refs/symbolic.py @@ -13,7 +13,8 @@ from gitdb.util import ( exists, isfile, rename, - hex_to_bin + hex_to_bin, + LockedFD ) from log import RefLog @@ -181,11 +182,13 @@ class SymbolicReference(object): raise TypeError("%s is a detached symbolic reference as it points to %r" % (self, sha)) return self.from_path(self.repo, target_ref_path) - def _set_reference(self, ref): + def _set_reference(self, ref, msg = None): """Set ourselves to the given ref. It will stay a symbol if the ref is a Reference. Otherwise we try to get a commit from it using our interface. - Strings are allowed but will be checked to be sure we have a commit""" + Strings are allowed but will be checked to be sure we have a commit + :param msg: If set to a string, the message will be used in the reflog. + Otherwise, a reflog entry is not written for the changed reference""" write_value = None if isinstance(ref, SymbolicReference): write_value = "ref: %s" % ref.path @@ -205,22 +208,6 @@ class SymbolicReference(object): # END end try string # END try commit attribute - # maintain the orig-head if we are currently checked-out - head = HEAD(self.repo) - try: - if head.ref == self: - try: - # TODO: implement this atomically, if we fail below, orig_head is at an incorrect spot - # Enforce the creation of ORIG_HEAD - SymbolicReference.create(self.repo, head.orig_head().name, self.commit, force=True) - except ValueError: - pass - #END exception handling - # END if we are checked-out - except TypeError: - pass - # END handle detached heads - # if we are writing a ref, use symbolic ref to get the reflog and more # checking # Otherwise we detach it and have to do it manually. Besides, this works |