@@ -528,13 +528,13 @@ def update(self):
528528
529529 Note:
530530 This is a possibly dangerious operations as it will discard your changes
531- to index.endtries
531+ to index.entries
532532
533533 Returns
534534 self
535535 """
536536 del (self .entries )
537- self . entries
537+ # allows to lazily reread on demand
538538 return self
539539
540540 def write_tree (self ):
@@ -623,7 +623,7 @@ def commit(self, message=None, parent_commits=None, **kwargs):
623623 raise NotImplementedError ("todo" )
624624
625625 @default_index
626- def reset (self , commit = 'HEAD' , working_tree = False , ** kwargs ):
626+ def reset (self , commit = 'HEAD' , working_tree = False , paths = None , ** kwargs ):
627627 """
628628 Reset the index to reflect the tree at the given commit. This will not
629629 adjust our HEAD reference as opposed to HEAD.reset.
@@ -636,11 +636,23 @@ def reset(self, commit='HEAD', working_tree=False, **kwargs):
636636 ``working_tree``
637637 If True, the files in the working tree will reflect the changed index.
638638 If False, the working tree will not be touched
639+ Please note that changes to the working copy will be discarded without
640+ warning !
639641
640642 ``**kwargs``
641643 Additional keyword arguments passed to git-reset
644+
645+ Returns
646+ self
642647 """
643- raise NotImplementedError ("todo: use git-read-tree if there is no working tree to update" )
648+ head = self .repo .head
649+ prev_commit = head .commit
650+
651+ # reset to get the tree/working copy
652+ head .reset (commit , index = True , working_tree = working_tree , paths = paths , ** kwargs )
653+ # put the head back
654+ head .reset (prev_commit , index = False , working_tree = False )
655+ return self
644656
645657 @default_index
646658 def diff (self , other = diff .Diffable .Index , paths = None , create_patch = False , ** kwargs ):
0 commit comments