summaryrefslogblamecommitdiffstats
path: root/test/conflicts.test
blob: b8c6d116027dffc547db6ac54f642947f1659a61 (plain) (tree)





























































                                                                        
                                                            











































































                                                                             
This test case creates a patch and then applies that patch to a modified
source file. The source file is modified until the patch doesn't apply
anymore, then the patch is fixed.

	$ mkdir d
	$ cd d

	$ cat > one.txt
	< 1
	< 2
	< 3
	< 4
	< 5
	< 6
	< 7
	< --
	< a
	< b
	< c
	< d
	< e
	< f
	< g
	
	$ quilt new a.diff
	> Patch a is now on top
	
	$ quilt add one.txt
	> File one.txt added to patch a
	
	$ mv one.txt one.orig
	$ sed -e "s/4/4+/" -e 's/d/d+/' one.orig > one.txt
	$ quilt refresh
	> Refreshed patch a

	$ quilt pop -q
	> Removing a
	> No patches applied


	$ sed -e "s/^\\([17]\\)\$/\\1-/" one.orig > one.txt
	$ quilt push -q
	> Applying a
	> Now at patch a

	$ quilt pop -q
	> Removing a
	> No patches applied

	$ sed -e "s/^\\([1267]\\)\$/\\1-/" one.orig > one.txt
	$ quilt push -q
	> Applying a
	> Now at patch a

	$ quilt pop -q
	> Removing a
	> No patches applied


	$ sed -e "s/^\\([123567]\\)\$/\\1-/" one.orig > one.txt
	$ quilt push -q
	> Applying a
	> 1 out of 2 hunks FAILED -- rejects in file one.txt
	> Patch a does not apply (enforce with -f)

	$ quilt push -qf
	> Applying a
	> 1 out of 2 hunks FAILED -- saving rejects to file one.txt.rej
	> Applied a (forced; needs refresh)

	$ mv one.txt one.x
	$ sed -e "s/4/4+/" one.x > one.txt
	$ rm one.x
	$ quilt diff -z | grep -v "^\\(---\\|+++\\)"
	> Index: d/one.txt
	> ===================================================================
	> @@ -1,7 +1,7 @@
	>  1-
	>  2-
	>  3-
	> -4
	> +4+
	>  5-
	>  6-
	>  7-

	$ quilt diff | grep -v "^\\(---\\|+++\\)"
	> Index: d/one.txt
	> ===================================================================
	> @@ -1,7 +1,7 @@
	>  1-
	>  2-
	>  3-
	> -4
	> +4+
	>  5-
	>  6-
	>  7-
	> @@ -9,7 +9,7 @@
	>  a
	>  b
	>  c
	> -d
	> +d+
	>  e
	>  f
	>  g

	$ quilt refresh
	> Refreshed patch a

	$ cat patches/a.diff | grep -v "^\\(---\\|+++\\)"
	> Index: d/one.txt
	> ===================================================================
	> @@ -1,7 +1,7 @@
	>  1-
	>  2-
	>  3-
	> -4
	> +4+
	>  5-
	>  6-
	>  7-
	> @@ -9,7 +9,7 @@
	>  a
	>  b
	>  c
	> -d
	> +d+
	>  e
	>  f
	>  g

	$ quilt pop -q
	> Removing a
	> No patches applied

	$ cd ..
	$ rm -rf d