mirror of
https://github.com/git/git
synced 2024-08-25 02:35:46 +00:00
Merge branch 'jk/filter-branch-use-of-sed-on-incomplete-line' into maint
"filter-branch" corrupted commit log message that ends with an incomplete line on platforms with some "sed" implementations that munge such a line. Work it around by avoiding to use "sed". * jk/filter-branch-use-of-sed-on-incomplete-line: filter-branch: avoid passing commit message through sed
This commit is contained in:
commit
a2e5c79c69
|
@ -346,7 +346,15 @@ while read commit parents; do
|
|||
die "parent filter failed: $filter_parent"
|
||||
fi
|
||||
|
||||
sed -e '1,/^$/d' <../commit | \
|
||||
{
|
||||
while read -r header_line && test -n "$header_line"
|
||||
do
|
||||
# skip header lines...
|
||||
:;
|
||||
done
|
||||
# and output the actual commit message
|
||||
cat
|
||||
} <../commit |
|
||||
eval "$filter_msg" > ../message ||
|
||||
die "msg filter failed: $filter_msg"
|
||||
workdir=$workdir @SHELL_PATH@ -c "$filter_commit" "git commit-tree" \
|
||||
|
|
|
@ -394,4 +394,14 @@ test_expect_success 'replace submodule revision' '
|
|||
test $orig_head != `git show-ref --hash --head HEAD`
|
||||
'
|
||||
|
||||
test_expect_success 'filter commit message without trailing newline' '
|
||||
git reset --hard original &&
|
||||
commit=$(printf "no newline" | git commit-tree HEAD^{tree}) &&
|
||||
git update-ref refs/heads/no-newline $commit &&
|
||||
git filter-branch -f refs/heads/no-newline &&
|
||||
echo $commit >expect &&
|
||||
git rev-parse refs/heads/no-newline >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
Loading…
Reference in a new issue