* git merge failed to detect conflict
@ 2011-06-19 15:51 Juergen Kosel
0 siblings, 0 replies; only message in thread
From: Juergen Kosel @ 2011-06-19 15:51 UTC (permalink / raw)
To: git
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
I have just steped into a boarder case, where git merge fails to detect
a merge conflict:
The commit A in the remote branch was the following:
diff --git a/LoWPAN.c b/LoWPAN.c
index 3e929e5..1b768e2 100644 (file)
- --- a/LoWPAN.c
+++ b/LoWPAN.c
@@ -431,12 +431,16 @@ int main (int argc, char **argv)
}
printf("\n");
#endif
- - // forward into kernel/tap device
- - retval=lowpan_writeout(&rx_packet,tap_fd);
- - if(retval<0) {
- - ERROR_OUTPUT("Failed to forward datagram into tap device: %s",
- - strerror(errno));
- - break; // leave the while loop
+ // ensure that we haven't got our own multicast
+ if((rx_packet.source.pan_id != own_802154_addr.pan_id)
+ || (rx_packet.source.short_addr != own_802154_addr.short_addr)) {
+ // forward into kernel/tap device
+ retval=lowpan_writeout(&rx_packet,tap_fd);
+ if(retval<0) {
+ ERROR_OUTPUT("Failed to forward datagram into tap device: %s",
+ strerror(errno));
+ break; // leave the while loop
+ }
}
}
}
The commit B in the local branch was:
diff --git a/LoWPAN.c b/LoWPAN.c
index 3e929e5..a7c65e3 100644 (file)
- --- a/LoWPAN.c
+++ b/LoWPAN.c
@@ -438,6 +438,8 @@ int main (int argc, char **argv)
strerror(errno));
break; // leave the while loop
}
+ DEBUG_OUTPUT("Successfully forwarded %d bytes into the tap device",
+ retval);
}
}
The resulting merge commit AB is:
diff --cc LoWPAN.c
index a7c65e3,1b768e2..92ec5f7
- --- 1/LoWPAN.c
- --- 2/LoWPAN.c
+++ b/LoWPAN.c
@@@ -431,15 -431,17 +431,19 @@@ int main (int argc, char **argv
}
printf("\n");
#endif
- - // forward into kernel/tap device
- - retval=lowpan_writeout(&rx_packet,tap_fd);
- - if(retval<0) {
- - ERROR_OUTPUT("Failed to forward datagram into tap device: %s",
- - strerror(errno));
- - break; // leave the while loop
+ // ensure that we haven't got our own multicast
+ if((rx_packet.source.pan_id != own_802154_addr.pan_id)
+ || (rx_packet.source.short_addr != own_802154_addr.short_addr)) {
+ // forward into kernel/tap device
+ retval=lowpan_writeout(&rx_packet,tap_fd);
+ if(retval<0) {
+ ERROR_OUTPUT("Failed to forward datagram into tap device: %s",
+ strerror(errno));
+ break; // leave the while loop
+ }
}
+ DEBUG_OUTPUT("Successfully forwarded %d bytes into the tap device",
+ retval);
}
}
If you just look at the diff output, it is difficult to see the problem.
But if you look at the corresponding code sections, than you see that
diff has splitted the conflictiong section into two none conflicting
sections.
Code A:
434 // ensure that we haven't got our own multicast
435 if((rx_packet.source.pan_id != own_802154_addr.pan_id)
436 || (rx_packet.source.short_addr !=
own_802154_addr.short_addr)) {
437 // forward into kernel/tap device
438 retval=lowpan_writeout(&rx_packet,tap_fd);
439 if(retval<0) {
440 ERROR_OUTPUT("Failed to forward datagram into tap device:
%s",
441 strerror(errno));
442 break; // leave the while loop
443 }
444 }
Code B:
434 // forward into kernel/tap device
435 retval=lowpan_writeout(&rx_packet,tap_fd);
436 if(retval<0) {
437 ERROR_OUTPUT("Failed to forward datagram into tap device: %s",
438 strerror(errno));
439 break; // leave the while loop
440 }
441 DEBUG_OUTPUT("Successfully forwarded %d bytes into the tap
device",
442 retval);
443 }
Code AB:
434 // ensure that we haven't got our own multicast
435 if((rx_packet.source.pan_id != own_802154_addr.pan_id)
436 || (rx_packet.source.short_addr !=
own_802154_addr.short_addr)) {
437 // forward into kernel/tap device
438 retval=lowpan_writeout(&rx_packet,tap_fd);
439 if(retval<0) {
440 ERROR_OUTPUT("Failed to forward datagram into tap device:
%s",
441 strerror(errno));
442 break; // leave the while loop
443 }
444 }
445 DEBUG_OUTPUT("Successfully forwarded %d bytes into the tap
device",
446 retval);
447 }
Obviously git/diff has failed to detect that human intervention is
required here. One _workaround_ would be, to demand in the coding style,
that closing braces get unique comments.
But what would be the solution of this problem?
Greetings
Juergen
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iD8DBQFN/hr95JgLPmj5988RAvEZAJ0R23PMc5xXfbKPCYnw3s8FGkqBqACgtpgV
96GejSM+XaPgg9p4XMpuF/k=
=zjX3
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-06-19 15:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-19 15:51 git merge failed to detect conflict Juergen Kosel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.