From: Juergen Kosel <juergen.kosel@gmx.de>
To: git@vger.kernel.org
Subject: git merge failed to detect conflict
Date: Sun, 19 Jun 2011 17:51:29 +0200 [thread overview]
Message-ID: <4DFE1B01.8050107@gmx.de> (raw)
-----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-----
reply other threads:[~2011-06-19 15:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4DFE1B01.8050107@gmx.de \
--to=juergen.kosel@gmx.de \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.