File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 199199 test -d " $tempdir " &&
200200 die " $tempdir already exists, please remove it"
201201esac
202+ orig_dir=$( pwd)
202203mkdir -p " $tempdir /t" &&
203204tempdir=" $( cd " $tempdir " ; pwd) " &&
204205cd " $tempdir /t" &&
205206workdir=" $( pwd) " ||
206207die " "
207208
208209# Remove tempdir on exit
209- trap ' cd ../.. ; rm -rf "$tempdir"' 0
210+ trap ' cd "$orig_dir" ; rm -rf "$tempdir"' 0
210211
211212ORIG_GIT_DIR=" $GIT_DIR "
212213ORIG_GIT_WORK_TREE=" $GIT_WORK_TREE "
@@ -469,7 +470,7 @@ if [ "$filter_tag_name" ]; then
469470 done
470471fi
471472
472- cd ../..
473+ cd " $orig_dir "
473474rm -rf " $tempdir "
474475
475476trap - 0
Original file line number Diff line number Diff line change @@ -64,6 +64,20 @@ test_expect_success 'correct GIT_DIR while using -d' '
6464 grep drepo "$TRASHDIR/backup-refs"
6565'
6666
67+ test_expect_success ' tree-filter works with -d' '
68+ git init drepo-tree &&
69+ (
70+ cd drepo-tree &&
71+ test_commit one &&
72+ git filter-branch -d "$TRASHDIR/dfoo" \
73+ --tree-filter "echo changed >one.t" &&
74+ echo changed >expect &&
75+ git cat-file blob HEAD:one.t >actual &&
76+ test_cmp expect actual &&
77+ test_cmp one.t actual
78+ )
79+ '
80+
6781test_expect_success ' Fail if commit filter fails' '
6882 test_must_fail git filter-branch -f --commit-filter "exit 1" HEAD
6983'
You can’t perform that action at this time.
0 commit comments