summaryrefslogtreecommitdiff
path: root/git-filter-branch.sh
diff options
context:
space:
mode:
Diffstat (limited to 'git-filter-branch.sh')
-rwxr-xr-xgit-filter-branch.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 178e453..2442536 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -217,6 +217,7 @@ t)
test -d "$tempdir" &&
die "$tempdir already exists, please remove it"
esac
+orig_dir=$(pwd)
mkdir -p "$tempdir/t" &&
tempdir="$(cd "$tempdir"; pwd)" &&
cd "$tempdir/t" &&
@@ -224,7 +225,7 @@ workdir="$(pwd)" ||
die ""
# Remove tempdir on exit
-trap 'cd ../..; rm -rf "$tempdir"' 0
+trap 'cd "$orig_dir"; rm -rf "$tempdir"' 0
ORIG_GIT_DIR="$GIT_DIR"
ORIG_GIT_WORK_TREE="$GIT_WORK_TREE"
@@ -489,7 +490,7 @@ if [ "$filter_tag_name" ]; then
done
fi
-cd ../..
+cd "$orig_dir"
rm -rf "$tempdir"
trap - 0