Skip to content

Commit 350d857

Browse files
matledgitster
authored andcommitted
filter-branch: prevent filters from reading from stdin
stdin is the list of commits when the env, tree and index filter are executed. The filters are not supposed to read anything from stdin so the best is to give them /dev/null for reading. Signed-off-by: Matthias Lederhofer <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent aee078b commit 350d857

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

git-filter-branch.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,21 +349,21 @@ while read commit; do
349349

350350
eval "$(set_ident AUTHOR <../commit)"
351351
eval "$(set_ident COMMITTER <../commit)"
352-
eval "$filter_env"
352+
eval "$filter_env" < /dev/null
353353

354354
if [ "$filter_tree" ]; then
355355
git-checkout-index -f -u -a
356356
# files that $commit removed are now still in the working tree;
357357
# remove them, else they would be added again
358358
git-ls-files -z --others | xargs -0 rm -f
359-
eval "$filter_tree"
359+
eval "$filter_tree" < /dev/null
360360
git-diff-index -r $commit | cut -f 2- | tr '\n' '\0' | \
361361
xargs -0 git-update-index --add --replace --remove
362362
git-ls-files -z --others | \
363363
xargs -0 git-update-index --add --replace --remove
364364
fi
365365

366-
eval "$filter_index"
366+
eval "$filter_index" < /dev/null
367367

368368
parentstr=
369369
for parent in $(get_parents $commit); do

0 commit comments

Comments
 (0)