chiark / gitweb /
X-Gmail-Received: cccbb3cdc84ae431fe07356861cbfa18540eab00
[stgit] / stgit / git.py
index 2cedeaa4d04007069468c518e6c830053f311397..a7b1c3f193041fd76aa9d1ad6afa0e5c1cf61e72 100644 (file)
@@ -205,7 +205,7 @@ def __tree_status(files = None, tree_id = 'HEAD', unknown = False,
     cache_files += [('C', filename) for filename in conflicts]
 
     # the rest
-    for line in _output_lines(['git-diff-index', '-r', tree_id] + files):
+    for line in _output_lines(['git-diff-index', tree_id] + files):
         fs = tuple(line.rstrip().split(' ',4)[-1].split('\t',1))
         if fs[1] not in conflicts:
             cache_files.append(fs)
@@ -603,18 +603,10 @@ def reset(files = None, tree_id = None):
     """Revert the tree changes relative to the given tree_id. It removes
     any local changes
     """
-    if not tree_id:
-        tree_id = get_head()
-
-    cache_files = __tree_status(files, tree_id)
-    rm_files =  [x[1] for x in cache_files if x[0] in ['D']]
-
     checkout(files, tree_id, True)
-    # checkout doesn't remove files
-    map(os.remove, rm_files)
 
     # if the reset refers to the whole tree, switch the HEAD as well
-    if not files:
+    if tree_id and not files:
         __set_head(tree_id)
 
 def pull(repository = 'origin', refspec = None):