Pijul

Explain Merge Conflicts (nested >>>>>>'s)

#1

Can someone explain this merge conflict? There’s >>>>>>, ======, and <<<<<<<. But then, in between ======= and <<<<<<< are groups of >>>>> and <<<<<<. Also, git puts the branch names in there as well to help the programmer more easily see what comes from where. Perhaps pijul could put the patch hash or something?

THREAD_RETURN_T peerclient_first(void *vargp) {
	Settings *settings = (Settings *) vargp;

	ThreadLog *threadLog = createThreadLog(settings, MUT("PeerClient"));
	
	logging_addInfoToThreadLog(threadLog, "Started thread.");
	
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
	pthread_t tid[55];
	for (int i = 0; i < 1; i++) {
		ThreadLog *threadLog = createThreadLog(settings, MUT("PeerClient"));
================================
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    int i = 0;
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    while (i < 1) {
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        int threadLog = createThreadLog(settings, logNamespace);
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
		
		clientRequestInfo *requestInfo = malloc(sizeof(clientRequestInfo) * 1);
		requestInfo->settings = settings;
		requestInfo->threadLog = threadLog;
		
		if (pthread_create(&tid[i], NULL, peerclient_request, (void *) requestInfo) != 0) {
			logError("PeerClient", "Failed to create thread");
		}
		++i;
	}
	
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
	for (int i = 0; i < 1; i++) {
		pthread_join(tid[i], NULL);
	}
================================
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    i = 0;
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    while (i < 1) {
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        pthread_join(tid[i++], NULL);
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
	
	sleep(4);
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

	for (int i = 0; i < 1; i++) {
		ThreadLog *threadLog = createThreadLog(settings, MUT("PeerClient"));
		
		clientRequestInfo *requestInfo = malloc(sizeof(clientRequestInfo) * 1);
		requestInfo->settings = settings;
		requestInfo->threadLog = threadLog;
================================
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    i = 0;
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    while (i < 1) {
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        int threadLog = createThreadLog(settings, logNamespace);
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
		
		if (pthread_create(&tid[i], NULL, peerclient_request, (void *) requestInfo) != 0) {
			logError("PeerClient", "Failed to create thread");
		}
	}
	
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
	for (int i = 0; i < 1; i++) {
		pthread_join(tid[i++], NULL);
	}
================================
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    i = 0;
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    while (i < 1) {
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        pthread_join(tid[i++], NULL);
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
	
	logging_addInfoToThreadLog(threadLog, "Closing.");
	
#ifndef _WIN32
	return NULL;
#endif
}
#2

Sections encased in >>>>>>> and <<<<<<<< without ======= are “zombies”, ie., lines that you’ve changed but another patch has deleted. I created a patch to mark them differently but it was broken by the diff package changes.

Agreed that some context should be shown but I’m not sure branch/repository is sufficient as it’s possible to get nested conflicts.

1 Like