summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0eab8ca)
raw | patch | inline | side by side (parent: 0eab8ca)
author | Brandon Casey <casey@nrlssc.navy.mil> | |
Mon, 28 Jan 2008 21:16:02 +0000 (15:16 -0600) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 30 Jan 2008 19:56:12 +0000 (11:56 -0800) |
One of the first things filter-branch does is to create a temporary
directory. This directory is eventually removed by the script during
normal operation, but is not removed if the script encounters an error.
Set a trap to remove it when the script terminates for any reason.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
directory. This directory is eventually removed by the script during
normal operation, but is not removed if the script encounters an error.
Set a trap to remove it when the script terminates for any reason.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-filter-branch.sh | patch | blob | history |
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index ebf05ca600739fcb8103dcebc6b9172eebfdacca..fbb948d6fd42091acade3fa807d5ff250cea651b 100755 (executable)
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
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
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" &&