aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgit-filter-branch.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index ebf05ca60..fbb948d6f 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -189,6 +189,9 @@ cd "$tempdir/t" &&
workdir="$(pwd)" ||
die ""
+# Remove tempdir on exit
+trap 'cd ../..; rm -rf "$tempdir"' 0
+
# Make sure refs/original is empty
git for-each-ref > "$tempdir"/backup-refs
while read sha1 type name
@@ -406,6 +409,8 @@ fi
cd ../..
rm -rf "$tempdir"
+trap - 0
+
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE
test -z "$ORIG_GIT_DIR" || GIT_DIR="$ORIG_GIT_DIR" && export GIT_DIR
test -z "$ORIG_GIT_WORK_TREE" || GIT_WORK_TREE="$ORIG_GIT_WORK_TREE" &&