{"thread":{"id":"27657","subject":"git merge failed to detect conflict","startedAt":"2011-06-19T15:51:29Z","lastAt":"2011-06-19T15:51:29Z","messageCount":1,"participants":["Juergen Kosel"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"170254","messageId":"4DFE1B01.8050107@gmx.de","threadId":"27657","inReplyTo":null,"subject":"git merge failed to detect conflict","fromName":"Juergen Kosel","fromEmail":"juergen.kosel@gmx.de","sentAt":"2011-06-19T15:51:29Z","receivedAt":"2011-06-19T15:51:29Z","isPatch":false,"sender":{"key":"juergen.kosel@gmx.de","avatar":null},"body":"-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA1\n\nHello,\n\nI have just steped into a boarder case, where git merge fails to detect\na merge conflict:\n\nThe commit A in the remote branch was the following:\n\ndiff --git a/LoWPAN.c b/LoWPAN.c\nindex 3e929e5..1b768e2 100644 (file)\n- --- a/LoWPAN.c\n+++ b/LoWPAN.c\n@@ -431,12 +431,16 @@ int main (int argc, char **argv)\n       }\n       printf(\"\\n\");\n #endif\n- -      // forward into kernel/tap device\n- -      retval=lowpan_writeout(&rx_packet,tap_fd);\n- -      if(retval<0) {\n- -       ERROR_OUTPUT(\"Failed to forward datagram into tap device: %s\",\n- -                    strerror(errno));\n- -       break; // leave the while loop\n+      // ensure that we haven't got our own multicast\n+      if((rx_packet.source.pan_id != own_802154_addr.pan_id)\n+        || (rx_packet.source.short_addr != own_802154_addr.short_addr)) {\n+       // forward into kernel/tap device\n+       retval=lowpan_writeout(&rx_packet,tap_fd);\n+       if(retval<0) {\n+         ERROR_OUTPUT(\"Failed to forward datagram into tap device: %s\",\n+                      strerror(errno));\n+         break; // leave the while loop\n+       }\n       }\n     }\n   }\n\nThe commit B in the local branch was:\ndiff --git a/LoWPAN.c b/LoWPAN.c\nindex 3e929e5..a7c65e3 100644 (file)\n- --- a/LoWPAN.c\n+++ b/LoWPAN.c\n@@ -438,6 +438,8 @@ int main (int argc, char **argv)\n                     strerror(errno));\n        break; // leave the while loop\n       }\n+      DEBUG_OUTPUT(\"Successfully forwarded %d bytes into the tap device\",\n+                  retval);\n     }\n   }\n\nThe resulting merge commit AB is:\ndiff --cc LoWPAN.c\nindex a7c65e3,1b768e2..92ec5f7\n- --- 1/LoWPAN.c\n- --- 2/LoWPAN.c\n+++ b/LoWPAN.c\n@@@ -431,15 -431,17 +431,19 @@@ int main (int argc, char **argv\n        }\n        printf(\"\\n\");\n  #endif\n- -       // forward into kernel/tap device\n- -       retval=lowpan_writeout(&rx_packet,tap_fd);\n- -       if(retval<0) {\n- -       ERROR_OUTPUT(\"Failed to forward datagram into tap device: %s\",\n- -                    strerror(errno));\n- -       break; // leave the while loop\n+       // ensure that we haven't got our own multicast\n+       if((rx_packet.source.pan_id != own_802154_addr.pan_id)\n+        || (rx_packet.source.short_addr != own_802154_addr.short_addr)) {\n+       // forward into kernel/tap device\n+       retval=lowpan_writeout(&rx_packet,tap_fd);\n+       if(retval<0) {\n+         ERROR_OUTPUT(\"Failed to forward datagram into tap device: %s\",\n+                      strerror(errno));\n+         break; // leave the while loop\n+       }\n        }\n +      DEBUG_OUTPUT(\"Successfully forwarded %d bytes into the tap device\",\n +                 retval);\n      }\n    }\n\nIf you just look at the diff output, it is difficult to see the problem.\nBut if you look at the corresponding code sections, than you see that\ndiff has splitted the conflictiong section into two none conflicting\nsections.\n\nCode A:\n\n 434       // ensure that we haven't got our own multicast\n 435       if((rx_packet.source.pan_id != own_802154_addr.pan_id)\n 436          || (rx_packet.source.short_addr !=\nown_802154_addr.short_addr)) {\n 437         // forward into kernel/tap device\n 438         retval=lowpan_writeout(&rx_packet,tap_fd);\n 439         if(retval<0) {\n 440           ERROR_OUTPUT(\"Failed to forward datagram into tap device:\n%s\",\n 441                        strerror(errno));\n 442           break; // leave the while loop\n 443         }\n 444       }\n\nCode B:\n\n 434       // forward into kernel/tap device\n 435       retval=lowpan_writeout(&rx_packet,tap_fd);\n 436       if(retval<0) {\n 437         ERROR_OUTPUT(\"Failed to forward datagram into tap device: %s\",\n 438                      strerror(errno));\n 439         break; // leave the while loop\n 440       }\n 441       DEBUG_OUTPUT(\"Successfully forwarded %d bytes into the tap\ndevice\",\n 442                    retval);\n 443     }\n\nCode AB:\n\n 434       // ensure that we haven't got our own multicast\n 435       if((rx_packet.source.pan_id != own_802154_addr.pan_id)\n 436          || (rx_packet.source.short_addr !=\nown_802154_addr.short_addr)) {\n 437         // forward into kernel/tap device\n 438         retval=lowpan_writeout(&rx_packet,tap_fd);\n 439         if(retval<0) {\n 440           ERROR_OUTPUT(\"Failed to forward datagram into tap device:\n%s\",\n 441                        strerror(errno));\n 442           break; // leave the while loop\n 443         }\n 444       }\n 445       DEBUG_OUTPUT(\"Successfully forwarded %d bytes into the tap\ndevice\",\n 446                    retval);\n 447     }\n\nObviously git/diff has failed to detect that human intervention is\nrequired here. One _workaround_ would be, to demand in the coding style,\nthat closing braces get unique comments.\nBut what would be the solution of this problem?\n\n\nGreetings\n\tJuergen\n-----BEGIN PGP SIGNATURE-----\nVersion: GnuPG v1.4.10 (GNU/Linux)\nComment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/\n\niD8DBQFN/hr95JgLPmj5988RAvEZAJ0R23PMc5xXfbKPCYnw3s8FGkqBqACgtpgV\n96GejSM+XaPgg9p4XMpuF/k=\n=zjX3\n-----END PGP SIGNATURE-----\n"}]}