Comment 6 for bug 75577

Revision history for this message
Aaron Bentley (abentley) wrote : Re: [Bug 75577] Re: shelve raises exception

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stuart Bishop wrote:
> Why is the patch ambiguous? There is one line starting with ' --'
> (leading whitespace indicating this is content and not a marker), and
> another line starting with '---' (no leading whitespace, this is a line
> to be removed).
>
> I can generate a similar diff and feed it to patch just fine and it
> works as expected.
>
> 07:58:53~/tmp/tst $ cp blah.sql blah2.sql
> 07:59:10~/tmp/tst $ cat blah.sql
> This is the first line
>
> -- This is a comment
> -- CREATE FUNCTION FOO
>
> This is the last line
> 07:59:12~/tmp/tst $ vi blah.sql
> 07:59:31~/tmp/tst $ diff blah.sql blah2.sql

It's specifically ambiguous for unified diffs, so this doesn't say anything.

> 07:59:56~/tmp/tst $ diff -u blah2.sql blah.sql
> --- blah2.sql 2006-12-22 07:59:04.000000000 +0700
> +++ blah.sql 2006-12-22 07:59:31.000000000 +0700
> @@ -1,6 +1,8 @@
> This is the first line
>
> -- This is a comment
> --- CREATE FUNCTION FOO
> +CREATE FUNCTION FOO
> +$$
> +$$;
>
> This is the last line

Here, you aren't removing a line that begins with --, so it's not ambiguous.

THIS is ambiguous:
abentley@lappy:~$ echo "-- tmp 2006-12-21 22:09:26.000000000 -0500" > tmp
abentley@lappy:~$ echo "++ tmp2 2006-10-27 19:16:03.000000000 -0400" >
tmp2
abentley@lappy:~$ diff -u tmp tmp2
- --- tmp 2006-12-21 22:10:22.000000000 -0500
+++ tmp2 2006-12-21 22:11:00.000000000 -0500
@@ -1 +1 @@
- --- tmp 2006-12-21 22:09:26.000000000 -0500
+++ tmp2 2006-10-27 19:16:03.000000000 -0400

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFi0060F+nu1YWqI0RAhN4AJoDmdPcBrJ1oC2L3dxJVVJfZNaWKgCeKsXw
W8fAz+IF2b5BNjkFXxgLWWo=
=U7YF
-----END PGP SIGNATURE-----