Skip to content

Commit 44a9b53

Browse files
committed
Merge branch 'jk/filter-branch-use-of-sed-on-incomplete-line' into maint
A recent "filter-branch --msg-filter" broke skipping of the commit object header, which is fixed. * jk/filter-branch-use-of-sed-on-incomplete-line: filter-branch: remove multi-line headers in msg filter
2 parents 1b5ffa3 + a5a4b3f commit 44a9b53

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

git-filter-branch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ while read commit parents; do
347347
fi
348348

349349
{
350-
while read -r header_line && test -n "$header_line"
350+
while IFS='' read -r header_line && test -n "$header_line"
351351
do
352352
# skip header lines...
353353
:;

t/t7003-filter-branch.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
test_description='git filter-branch'
44
. ./test-lib.sh
5+
. "$TEST_DIRECTORY/lib-gpg.sh"
56

67
test_expect_success 'setup' '
78
test_commit A &&
@@ -292,6 +293,19 @@ test_expect_success 'Tag name filtering strips gpg signature' '
292293
test_cmp expect actual
293294
'
294295

296+
test_expect_success GPG 'Filtering retains message of gpg signed commit' '
297+
mkdir gpg &&
298+
touch gpg/foo &&
299+
git add gpg &&
300+
test_tick &&
301+
git commit -S -m "Adding gpg" &&
302+
303+
git log -1 --format="%s" > expect &&
304+
git filter-branch -f --msg-filter "cat" &&
305+
git log -1 --format="%s" > actual &&
306+
test_cmp expect actual
307+
'
308+
295309
test_expect_success 'Tag name filtering allows slashes in tag names' '
296310
git tag -m tag-with-slash X/1 &&
297311
git cat-file tag X/1 | sed -e s,X/1,X/2, > expect &&

0 commit comments

Comments
 (0)