From: Catalin Marinas Date: Thu, 22 Dec 2005 14:26:42 +0000 (+0000) Subject: "status --reset" does not restore the deleted files X-Git-Tag: v0.8~1 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/2c4a491648aaf117a6d1b5af23b8b40be0d6dc4b "status --reset" does not restore the deleted files Actually, the broken code was restoring but deleting them. This was because git.reset() command was used in the past instead of git.switch(). This patch fixed it. Signed-off-by: Catalin Marinas --- diff --git a/stgit/git.py b/stgit/git.py index dd7821e..a7b1c3f 100644 --- a/stgit/git.py +++ b/stgit/git.py @@ -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):