diffr icon indicating copy to clipboard operation
diffr copied to clipboard

Support for diff3

Open ElieGouzien opened this issue 5 years ago • 2 comments

It would be nice if diffr could support diff3 as generated by git during merges. Currently it simply ignores changes from on side.

ElieGouzien avatar Dec 08 '19 23:12 ElieGouzien

Hi @ElieGouzien,

I see on the --help page of git that it produces something like

diff --combined describe.c
index fabadb8,cc95eb0..4866510
--- a/describe.c
+++ b/describe.c
@@@ -98,20 -98,12 +98,20 @@@
        return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
  }

- static void describe(char *arg)
 -static void describe(struct commit *cmit, int last_one)
++static void describe(char *arg, int last_one)
  {
 +      unsigned char sha1[20];
 +      struct commit *cmit;
        struct commit_list *list;
        static int initialized = 0;
        struct commit_name *n;

 +      if (get_sha1(arg, sha1) < 0)
 +              usage(describe_usage);
 +      cmit = lookup_commit_reference(sha1);
 +      if (!cmit)
 +              usage(describe_usage);
 +
        if (!initialized) {
                initialized = 1;
                for_each_ref(get_name);

which seems different from what is traditionally designated as diff3 format. Which one are you referring to?

mookid avatar Dec 09 '19 13:12 mookid

You are right, I was thinking about the one from git. Lines like

 -static void describe(struct commit *cmit, int last_one)

are not considered by diffr as a diff due to the leading space.

Sorry for the confusion.

ElieGouzien avatar Dec 09 '19 14:12 ElieGouzien