Skip to content

Commit

Permalink
Merge branch 'jk/filter-branch-use-of-sed-on-incomplete-line' into maint
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gitster committed Oct 20, 2015
2 parents 1b5ffa3 + a5a4b3f commit 44a9b53
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion git-filter-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ while read commit parents; do
fi

{
while read -r header_line && test -n "$header_line"
while IFS='' read -r header_line && test -n "$header_line"
do
# skip header lines...
:;
Expand Down
14 changes: 14 additions & 0 deletions t/t7003-filter-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

test_description='git filter-branch'
. ./test-lib.sh
. "$TEST_DIRECTORY/lib-gpg.sh"

test_expect_success 'setup' '
test_commit A &&
Expand Down Expand Up @@ -292,6 +293,19 @@ test_expect_success 'Tag name filtering strips gpg signature' '
test_cmp expect actual
'

test_expect_success GPG 'Filtering retains message of gpg signed commit' '
mkdir gpg &&
touch gpg/foo &&
git add gpg &&
test_tick &&
git commit -S -m "Adding gpg" &&
git log -1 --format="%s" > expect &&
git filter-branch -f --msg-filter "cat" &&
git log -1 --format="%s" > actual &&
test_cmp expect actual
'

test_expect_success 'Tag name filtering allows slashes in tag names' '
git tag -m tag-with-slash X/1 &&
git cat-file tag X/1 | sed -e s,X/1,X/2, > expect &&
Expand Down

0 comments on commit 44a9b53

Please sign in to comment.