blob: 2fc505a7eb0f14dff20fa39b412052f23ad64dfd (
plain) (
tree)
|
|
# Check that quilt properly deals with patches which delete vs. empty files
# Prepare the working tree
$ mkdir patches
$ echo "will be deleted" > deleted1
$ echo "will be emptied" > emptied1
$ echo "will be deleted" > deleted2
$ echo "will be emptied" > emptied2
# Prepate the patches and series
$ cat > patches/series
< using-filenames.patch
< using-timestamps.patch
$ cat > patches/using-filenames.patch
< diff -ruN a/deleted1 b/deleted1
< --- a/deleted1
< +++ /dev/null
< @@ -1 +0,0 @@
< -will be deleted
< diff -ruN a/emptied1 b/emptied1
< --- a/emptied1
< +++ b/emptied1
< @@ -1 +0,0 @@
< -will be emptied
$ cat > patches/using-timestamps.patch
< diff -ruN a/deleted2 b/deleted2
< --- a/deleted2 2014-01-15 11:19:43.000000000 +0100
< +++ b/deleted2 1970-01-01 01:00:00.000000000 +0100
< @@ -1 +0,0 @@
< -will be deleted
< diff -ruN a/emptied2 b/emptied2
< --- a/emptied2 2014-01-15 11:19:59.000000000 +0100
< +++ b/emptied2 2014-01-15 11:20:11.000000000 +0100
< @@ -1 +0,0 @@
< -will be emptied
# Test quilt push
$ quilt push
> Applying patch patches/using-filenames.patch
> patching file deleted1
> patching file emptied1
>
> Now at patch patches/using-filenames.patch
$ if test -e deleted1; then if test -s deleted1; then echo "File deleted1 is not empty" ; else echo "File deleted1 is empty" ; fi ; else echo "File deleted1 does not exist" ; fi
> File deleted1 does not exist
$ if test -e emptied1; then if test -s emptied1; then echo "File emptied1 is not empty" ; else echo "File emptied1 is empty" ; fi ; else echo "File emptied1 does not exist" ; fi
> File emptied1 is empty
$ quilt push
> Applying patch patches/using-timestamps.patch
> patching file deleted2
> patching file emptied2
>
> Now at patch patches/using-timestamps.patch
$ if test -e deleted2; then if test -s deleted2; then echo "File deleted2 is not empty" ; else echo "File deleted2 is empty" ; fi ; else echo "File deleted2 does not exist" ; fi
> File deleted2 does not exist
$ if test -e emptied2; then if test -s emptied2; then echo "File emptied2 is not empty" ; else echo "File emptied2 is empty" ; fi ; else echo "File emptied2 does not exist" ; fi
> File emptied2 is empty
# Test quilt fold
$ quilt pop -aq
> Removing patch patches/using-timestamps.patch
> Removing patch patches/using-filenames.patch
> No patches applied
$ quilt new fold.patch
> Patch patches/fold.patch is now on top
$ quilt fold < patches/using-filenames.patch
> patching file deleted1
> patching file emptied1
$ if test -e deleted1; then if test -s deleted1; then echo "File deleted1 is not empty" ; else echo "File deleted1 is empty" ; fi ; else echo "File deleted1 does not exist" ; fi
> File deleted1 does not exist
$ if test -e emptied1; then if test -s emptied1; then echo "File emptied1 is not empty" ; else echo "File emptied1 is empty" ; fi ; else echo "File emptied1 does not exist" ; fi
> File emptied1 is empty
$ quilt fold < patches/using-timestamps.patch
> patching file deleted2
> patching file emptied2
$ if test -e deleted2; then if test -s deleted2; then echo "File deleted2 is not empty" ; else echo "File deleted2 is empty" ; fi ; else echo "File deleted2 does not exist" ; fi
> File deleted2 does not exist
$ if test -e emptied2; then if test -s emptied2; then echo "File emptied2 is not empty" ; else echo "File emptied2 is empty" ; fi ; else echo "File emptied2 does not exist" ; fi
> File emptied2 is empty
# Test quilt refresh
$ quilt delete
> Removing patch patches/fold.patch
> No patches applied
> Removed patch patches/fold.patch
$ quilt push -q
> Applying patch patches/using-filenames.patch
> Now at patch patches/using-filenames.patch
$ quilt refresh -pab --sort --no-index
> Refreshed patch patches/using-filenames.patch
$ quilt pop -q
> Removing patch patches/using-filenames.patch
> No patches applied
$ quilt push
> Applying patch patches/using-filenames.patch
> patching file deleted1
> patching file emptied1
>
> Now at patch patches/using-filenames.patch
$ if test -e deleted1; then if test -s deleted1; then echo "File deleted1 is not empty" ; else echo "File deleted1 is empty" ; fi ; else echo "File deleted1 does not exist" ; fi
> File deleted1 does not exist
$ if test -e emptied1; then if test -s emptied1; then echo "File emptied1 is not empty" ; else echo "File emptied1 is empty" ; fi ; else echo "File emptied1 does not exist" ; fi
> File emptied1 is empty
$ cat patches/using-filenames.patch
> --- a/deleted1
> +++ /dev/null
> @@ -1 +0,0 @@
> -will be deleted
> --- a/emptied1
> +++ b/emptied1
> @@ -1 +0,0 @@
> -will be emptied
|