mirror of
https://https.git.savannah.gnu.org/git/patch.git
synced 2026-01-30 03:14:35 +00:00
Diffs can be indented by a variable number of spaces, tabs, or X characters. Make sure that intuit_diff_type() only accepts context diffs where the first and second line are indented identically, or else another_hunk() will fail. * src/pch.c (intuit_diff_type): Remember the indentation of the last line. Only recognize context diff hunks with the same amount of indentation on the first and second line. * tests/garbage: New test case. * tests/Makefile.am (TESTS): Add test case.
26 lines
563 B
Plaintext
26 lines
563 B
Plaintext
# Copyright (C) 2015 Free Software Foundation, Inc.
|
|
#
|
|
# Copying and distribution of this file, with or without modification,
|
|
# in any medium, are permitted without royalty provided the copyright
|
|
# notice and this notice are preserved.
|
|
|
|
. $srcdir/test-lib.sh
|
|
|
|
require cat
|
|
use_local_patch
|
|
use_tmpdir
|
|
|
|
# ==============================================================
|
|
|
|
cat > bad.diff <<EOF
|
|
***************
|
|
*** 0 ****
|
|
--- 1 ----
|
|
+ foo
|
|
EOF
|
|
|
|
check 'patch foo -i bad.diff || echo "Status: $?"' <<EOF
|
|
$PATCH: **** Only garbage was found in the patch input.
|
|
Status: 2
|
|
EOF
|