summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
e2d769b)
By default, the git.reset() command was setting the head to the 'HEAD'
value (introduced by commit
15de5ae14f1c76adac52ca5633a679fba79a877c).
This patch fixes it and also adds an assert in the __set_head()
function to detect future bugs.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
raise GitException, 'Could not update HEAD to "%s".' % val
__head = val
raise GitException, 'Could not update HEAD to "%s".' % val
__head = val
+ # only allow SHA1 hashes
+ assert(len(__head) == 40)
+
def __clear_head_cache():
"""Sets the __head to None so that a re-read is forced
"""
def __clear_head_cache():
"""Sets the __head to None so that a re-read is forced
"""
-def reset(files = None, tree_id = 'HEAD'):
+def reset(files = None, tree_id = None):
"""Revert the tree changes relative to the given tree_id. It removes
any local changes
"""
"""Revert the tree changes relative to the given tree_id. It removes
any local changes
"""
+ if not tree_id:
+ tree_id = get_head()
+
checkout(files, tree_id, True)
# if the reset refers to the whole tree, switch the HEAD as well
checkout(files, tree_id, True)
# if the reset refers to the whole tree, switch the HEAD as well
- if tree_id and not files:
__set_head(tree_id)
def pull(repository = 'origin', refspec = None):
__set_head(tree_id)
def pull(repository = 'origin', refspec = None):