mirror of
https://https.git.savannah.gnu.org/git/patch.git
synced 2026-01-28 02:15:16 +00:00
116 lines
2.6 KiB
Plaintext
116 lines
2.6 KiB
Plaintext
# Copyright (C) 2009 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
|
|
require_diff
|
|
use_local_patch
|
|
use_tmpdir
|
|
|
|
# ==============================================================
|
|
|
|
# Bug #25970: intuit_diff_type: Assertion `i0 != NONE' failed.
|
|
|
|
cat > f.diff <<EOF
|
|
--- f
|
|
+++ f
|
|
@@ -1 +0,0 @@
|
|
-one
|
|
EOF
|
|
|
|
echo one > f
|
|
check 'patch -f -p1 < f.diff || echo "Status: $?"' <<EOF
|
|
can't find file to patch at input line 3
|
|
Perhaps you used the wrong -p or --strip option?
|
|
The text leading up to this was:
|
|
--------------------------
|
|
|--- f
|
|
|+++ f
|
|
--------------------------
|
|
No file to patch. Skipping patch.
|
|
1 out of 1 hunk ignored
|
|
Status: 1
|
|
EOF
|
|
|
|
# ==============================================================
|
|
|
|
echo one > f
|
|
diff -u /dev/null f > f.diff
|
|
|
|
check 'patch -f < f.diff || echo "Status: $?"' <<EOF
|
|
The next patch would create the file f,
|
|
which already exists! Applying it anyway.
|
|
patching file f
|
|
Hunk #1 FAILED at 1.
|
|
1 out of 1 hunk FAILED -- saving rejects to file f.rej
|
|
Status: 1
|
|
EOF
|
|
|
|
# ==============================================================
|
|
|
|
echo one > f
|
|
diff -u f /dev/null > f.diff
|
|
rm f
|
|
check 'patch -p0 < f.diff || echo "Status: $?"' <<EOF
|
|
The next patch would delete the file f,
|
|
which does not exist! Assume -R? [n]
|
|
Apply anyway? [n]
|
|
Skipping patch.
|
|
1 out of 1 hunk ignored
|
|
Status: 1
|
|
EOF
|
|
|
|
# ==============================================================
|
|
|
|
echo one > f
|
|
diff -u f /dev/null > f.diff
|
|
rm f
|
|
check 'patch -p0 -f < f.diff || echo "Status: $?"' <<EOF
|
|
The next patch would delete the file f,
|
|
which does not exist! Applying it anyway.
|
|
patching file f
|
|
Hunk #1 FAILED at 1.
|
|
1 out of 1 hunk FAILED -- saving rejects to file f.rej
|
|
Status: 1
|
|
EOF
|
|
|
|
# ==============================================================
|
|
|
|
umask 022
|
|
|
|
echo one > f
|
|
diff -u f /dev/null > f.diff
|
|
rm f
|
|
check 'patch -f f < f.diff || echo "Status: $?"' <<EOF
|
|
The next patch would delete the file f,
|
|
which does not exist! Applying it anyway.
|
|
patching file f
|
|
Hunk #1 FAILED at 1.
|
|
1 out of 1 hunk FAILED -- saving rejects to file f.rej
|
|
Status: 1
|
|
EOF
|
|
|
|
check 'ls -l f.orig | sed "s,\(..........\).*,\1,"' <<EOF
|
|
-rw-r--r--
|
|
EOF
|
|
|
|
# ==============================================================
|
|
|
|
rm f.orig
|
|
echo f > f.orig
|
|
rm -f f
|
|
touch f
|
|
diff -u f.orig f > f.diff
|
|
check 'patch -f < f.diff || echo "Status: $?"' <<EOF
|
|
The next patch would empty out the file f,
|
|
which is already empty! Applying it anyway.
|
|
patching file f
|
|
Hunk #1 FAILED at 1.
|
|
1 out of 1 hunk FAILED -- saving rejects to file f.rej
|
|
Status: 1
|
|
EOF
|