]> git.neil.brown.name Git - wiggle.git/commitdiff
merge: remove useless context at the start of a conflict.
authorNeilBrown <neilb@suse.de>
Wed, 13 Feb 2013 23:22:18 +0000 (10:22 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 13 Feb 2013 23:22:18 +0000 (10:22 +1100)
There are two fixes here.

The first allows the newline at the end of an unchanged region to be
the 'first' newline found so that if there are several others to
provide backup, it will be used.

The second allows the start-of-file to be strong enough context to
not require three full lines of explicit context.

Then we change a lot of the self-tests to match.  In each case the
result is a clear improvement.

Signed-off-by: NeilBrown <neilb@suse.de>
merge2.c
tests/linux/inode-justrej/lmerge
tests/linux/md-loop/merge
tests/linux/raid1-A/merge
tests/simple/conflict/merge
tests/simple/conflictmixed/lmerge
tests/simple/conflictmixed/merge
tests/simple/multiple-add/lmerge
tests/simple/show-wiggle-1/Wmerge

index 92f5c22ca97635c0f4a86dab62bd5342e3405b42..b2cc4cfb5b2612bc96dc6c925ad124de1bf6cc6e 100644 (file)
--- a/merge2.c
+++ b/merge2.c
@@ -190,7 +190,7 @@ int isolate_conflicts(struct file af, struct file bf, struct file cf,
                                         */
                                        for (k = m[j].al; k > 0; k--)
                                                if (ends_line(af.list[m[j].a+k-1])) {
-                                                       if (firstk >= m[j].al)
+                                                       if (firstk > m[j].al)
                                                                firstk = k;
                                                        newlines++;
                                                        if (newlines >= 3) {
@@ -200,6 +200,8 @@ int isolate_conflicts(struct file af, struct file bf, struct file cf,
                                                }
                                        if (k > 0)
                                                m[j].hi = k;
+                                       else if (j == 0)
+                                               m[j].hi = firstk;
                                        else if (is_cutpoint(m[j], af,bf,cf))
                                                m[j].hi = 0;
                                        else
index 08b0a9b0c87d259aa6e4844b5717348affd24f51..685b14ece340be550cac53c1a266abe395e60b61 100644 (file)
@@ -952,14 +952,12 @@ void remove_inode_hash(struct inode *inode)
 void generic_delete_inode(struct inode *inode)
 {
        struct super_operations *op = inode->i_sb->s_op;
-<<<<<<<
 
+<<<<<<<
        hlist_del_init(&inode->i_hash);
 |||||||
-
        list_del_init(&inode->i_hash);
 =======
-
 >>>>>>>
        list_del_init(&inode->i_list);
        inode->i_state|=I_FREEING;
index ebb59eafaaf0bfecdf9c070c44af56456dc2df00..682ed2046846d114468171be185c0c41d239e36b 100644 (file)
@@ -3950,13 +3950,11 @@ MD_EXPORT_SYMBOL(md_update_sb);
 MD_EXPORT_SYMBOL(md_wakeup_thread);
 MD_EXPORT_SYMBOL(md_print_devices);
 MD_EXPORT_SYMBOL(find_rdev_nr);
-<<<<<<<
 MD_EXPORT_SYMBOL(md_interrupt_thread);
+<<<<<<<
 MD_EXPORT_SYMBOL(mddev_map);
 |||||||
-MD_EXPORT_SYMBOL(md_interrupt_thread);
 EXPORT_SYMBOL(mddev_map);
 =======
-MD_EXPORT_SYMBOL(md_interrupt_thread);
 >>>>>>>
 MODULE_LICENSE("GPL");
index 86abd0bb3b8c082f6f885353952e6e922b69471f..8361ac4a1a206e92eb0d2d4786979f7743250b0b 100644 (file)
@@ -710,14 +710,12 @@ static int make_request(mddev_t *mddev, struct bio * bio)
        struct bio *read_bio;
        int i, targets = 0, disks;
        struct bitmap *bitmap;
-<<<<<<<
        unsigned long flags;
+<<<<<<<
 |||||||
-       unsigned long flags;
        struct bio_list bl;
        struct page **behind_pages = NULL;
 =======
-       unsigned long flags;
        struct bio_list bl;
        int bl_count;
        struct page **behind_pages = NULL;
@@ -1951,8 +1949,8 @@ static conf_t *setup_conf(mddev_t *mddev)
        spin_lock_init(&conf->resync_lock);
        init_waitqueue_head(&conf->wait_barrier);
 
-<<<<<<<
        bio_list_init(&conf->pending_bio_list);
+<<<<<<<
 
        conf->last_used = -1;
        for (i = 0; i < conf->raid_disks; i++) {
@@ -2320,12 +2318,10 @@ MODULE_ALIAS("md-level-1");
 
 module_param(max_queued, int, S_IRUGO|S_IWUSR);
 |||||||
-       bio_list_init(&conf->pending_bio_list);
        bio_list_init(&conf->flushing_bio_list);
 
 
 =======
-       bio_list_init(&conf->pending_bio_list);
        conf->pending_count = 0;
        bio_list_init(&conf->flushing_bio_list);
 
index 8bbd48730a40cb628035516b68a2023d1edf8724..fb97f49aad2ef971dabc315beb3b920ee6d7b9e7 100644 (file)
@@ -1,16 +1,12 @@
-<<<<<<<
 this is a file
 with the word
+<<<<<<<
 two which is
 misspelt
 |||||||
-this is a file
-with the word
 to which is
 misspelt
 =======
-this is a file
-with the word
 too which is
 misspelt
 >>>>>>>
index 6d7071ee5a44bbfbefd311586dba20f4d43e80b3..bb4d03c3f97508a6c868e5dd16fa833460faf831 100644 (file)
@@ -1,14 +1,10 @@
-<<<<<<<
 this is a file
 with the word
+<<<<<<<
 two which is
 |||||||
-this is a file
-with the word
 to which is
 =======
-this is a file
-with the word
 too which was
 >>>>>>>
 misspelt
index bb38d8a741514fc17ad8e7477a97a2f4aa5c6147..5af8ed0fcc72c7964ce4906b5f838c80e5bc75f6 100644 (file)
@@ -1,16 +1,12 @@
-<<<<<<<
 this is a file
 with the word
+<<<<<<<
 two which is
 misspelt
 |||||||
-this is a file
-with the word
 to which is
 misspelt
 =======
-this is a file
-with the word
 too which was
 misspelt
 >>>>>>>
index 5827de2718b731779ec0ba20756fdd7c1aec55a5..f2a4151609b7bf486f936a84e93c7d22ea9de316 100644 (file)
@@ -4,14 +4,12 @@ the
 current
 version
 of
-<<<<<<<
 the
+<<<<<<<
 file.
 |||||||
-the
 file
 =======
-the
 file that has changed
 >>>>>>>
 
index d5cba671af0de64a4bb4016bb0b11b76e489ab09..805a091f3d61210d195dd5ebf8c8c33c94aec705 100644 (file)
@@ -1,17 +1,14 @@
-<<<<<<<
 
+<<<<<<<
 This is one line of the file
 
 |||||||
-
 This is 1 line of the file
 
 =======
-
 This is 1 line of the document
 
 &&&&&&&
-
 This is one line of the document
 
 >>>>>>>