Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make S3M's conflicts wrap only the conflicting lines #101

Open
jvcoutinho opened this issue Aug 27, 2019 · 3 comments
Open

Make S3M's conflicts wrap only the conflicting lines #101

jvcoutinho opened this issue Aug 27, 2019 · 3 comments

Comments

@jvcoutinho
Copy link
Collaborator

Currently, S3M's conflicts wrap all of a node's content inside the conflict text. So, in this scenario:

BASE

void m() {
  int a;
}

LEFT

void n1() {
  int a;
}

RIGHT

void n2() {
  int a;
}

(That means, left and right renamed the same method to different signatures.)
The merge result is:

<<<<<<< MINE
void n1() {
  int a;
}
======= 
void n2() {
  int a;
}
>>>>>>> YOURS

instead of:

<<<<<<< MINE
void n1() {
======= 
void n2() {
>>>>>>> YOURS
  int a;
}

This is only an enhancement to a more elegant (and concise) conflict text.

@pauloborba
Copy link
Collaborator

@jvcoutinho what about when there is a conflict in the body too? aren't the body conflicts add too much noise to the merge results?

@jvcoutinho
Copy link
Collaborator Author

This would only "shrink" the merge conflict, eliminating common parts at the edge.

For example, in the following scenario:

LEFT

    public void n1() {
        int a;

        int b1;
        
        int c1;

        int d;
    }

BASE

    public void m() {
        int a;

        int b;

        int c;

        int d;
    }

LEFT

    public void n2() {
        int a;

        int b2;
        
        int c2;

        int d;
    }

Unstructured merge outputs this:

<<<<<<< MINE
    public void n1() {
=======
    public void n2() {
>>>>>>> YOURS
        int a;

<<<<<<< MINE
        int b1;
        
        int c1;
=======
        int b2;
        
        int c2;
>>>>>>> YOURS

        int d;
    }

Meanwhile, semistructured merge + renaming handler output this:

<<<<<<< MINE
    public void n1() {
        int a;

        int b1;
        
        int c1;

        int d;
    }
======= 
    public void n2() {
        int a;

        int b2;
        
        int c2;

        int d;
    }
>>>>>>> YOURS

With this change, it would output this:

<<<<<<< MINE
    public void n1() {
        int a;

        int b1;
        
        int c1;
======= 
    public void n2() {
        int a;

        int b2;
        
        int c2;
>>>>>>> YOURS

        int d;
    }

@guilhermejccavalcanti
Copy link
Owner

Interesting, the unstructured merge output is totally accurate in terms of marking only the conflicting changes.

However between default semistructured and the proposed change, for me, default is better: whyint ais in the conflict, but int d is not? none of them have been changed, so they both should be out of the conflicts as in unstructured merge, or both of them should be in the conflict as default semistructured merge. Having one of the declarations in the conflict and the other not seems inconsistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants