File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 199
199
test -d " $tempdir " &&
200
200
die " $tempdir already exists, please remove it"
201
201
esac
202
+ orig_dir=$( pwd)
202
203
mkdir -p " $tempdir /t" &&
203
204
tempdir=" $( cd " $tempdir " ; pwd) " &&
204
205
cd " $tempdir /t" &&
205
206
workdir=" $( pwd) " ||
206
207
die " "
207
208
208
209
# Remove tempdir on exit
209
- trap ' cd ../.. ; rm -rf "$tempdir"' 0
210
+ trap ' cd "$orig_dir" ; rm -rf "$tempdir"' 0
210
211
211
212
ORIG_GIT_DIR=" $GIT_DIR "
212
213
ORIG_GIT_WORK_TREE=" $GIT_WORK_TREE "
@@ -469,7 +470,7 @@ if [ "$filter_tag_name" ]; then
469
470
done
470
471
fi
471
472
472
- cd ../..
473
+ cd " $orig_dir "
473
474
rm -rf " $tempdir "
474
475
475
476
trap - 0
Original file line number Diff line number Diff line change @@ -64,6 +64,20 @@ test_expect_success 'correct GIT_DIR while using -d' '
64
64
grep drepo "$TRASHDIR/backup-refs"
65
65
'
66
66
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
+
67
81
test_expect_success ' Fail if commit filter fails' '
68
82
test_must_fail git filter-branch -f --commit-filter "exit 1" HEAD
69
83
'
You can’t perform that action at this time.
0 commit comments