From 61f3db7bd07ac2f3c2ff54615c13bf9219289932 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 23 Nov 2010 22:47:34 +0100 Subject: 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 --- refs/symbolic.py | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) (limited to 'refs/symbolic.py') 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 -- cgit v1.2.3