aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2012-04-24 19:31:13 +0100
committerCatalin Marinas <catalin.marinas@gmail.com>2012-04-30 11:34:09 +0100
commit167d00af778fafb732288d66f4be3dce78222cd5 (patch)
tree6e23e7a0163891c3f28bd1c5a190285bf7c99f02
parent27ac3b84aaab17eeb055befe249d235a0eb556b5 (diff)
downloadstgit-167d00af778fafb732288d66f4be3dce78222cd5.tar.gz
stgit/git.py: Handle a reset that changes files to directories
If reset() takes us from a tree where some path is a file to one where it is a directory, then checkout() will replace the file with the directory, and we don't want to try to os.remove() the path (which would throw an exception because we're trying to remove a directory.) This fixes bug https://gna.org/bugs/?15682. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
-rw-r--r--stgit/git.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/stgit/git.py b/stgit/git.py
index 0316342..b94b445 100644
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -745,7 +745,7 @@ def reset(files = None, tree_id = None, check_out = True):
checkout(files, tree_id, True)
# checkout doesn't remove files
- map(os.remove, rm_files)
+ map(os.remove, [f for f in rm_files if not os.path.isdir(f)])
# if the reset refers to the whole tree, switch the HEAD as well
if not files: