git-2.22.0/rerere.c
/*
 * Read contents a file with conflicts, normalize the conflicts
 * by (1) discarding the common ancestor version in diff3-style,
 * (2) reordering our side and their side so that whichever sorts
 * alphabetically earlier comes before the other one, while
 * computing the "conflict ID", which is just an SHA-1 hash of
 * one side of the conflict, NUL, the other side of the conflict,
 * and NUL concatenated together.
 *
 * Return 1 if conflict hunks are found, 0 if there are no conflict
 * hunks and -1 if an error occured.
 */
Read contents a file with conflicts, normalize the conflicts
by (1) discarding the common ancestor version in diff3-style,
(2) reordering our side and their side so that whichever sorts
alphabetically earlier comes before the other one, while
computing the "conflict ID", which is just an SHA-1 hash of
one side of the conflict, NUL, the other side of the conflict,
and NUL concatenated together.

Return 1 if conflict hunks are found, 0 if there are no conflict
hunks and -1 if an error occured.
Read contents a file with conflicts normalize the conflicts by ( 1 ) discarding the common ancestor version in diff3 - style ( 2 ) reordering our side and their side so that whichever sorts alphabetically earlier comes before the other one while computing the " conflict ID " which is just an SHA - 1 hash of one side of the conflict NUL the other side of the conflict and NUL concatenated together . Return 1 if conflict hunks are found 0 if there are no conflict hunks and - 1 if an error occured .
static int handle_path(unsigned char *hash, struct rerere_io *io, int marker_size)
{
	git_hash_ctx ctx;
	struct strbuf buf = STRBUF_INIT, out = STRBUF_INIT;
	int has_conflicts = 0;
	if (hash)
		the_hash_algo->init_fn(&ctx);
	while (!io->getline(&buf, io)) {
		if (is_cmarker(buf.buf, '<', marker_size)) {
			has_conflicts = handle_conflict(&out, io, marker_size,
							hash ? &ctx : NULL);
			if (has_conflicts < 0)
				break;
			rerere_io_putmem(out.buf, out.len, io);
			strbuf_reset(&out);
		} else
			rerere_io_putstr(buf.buf, io);
	}
	strbuf_release(&buf);
	strbuf_release(&out);
	if (hash)
		the_hash_algo->final_fn(hash, &ctx);
	return has_conflicts;
}
static int handle_path ( unsigned char * hash , struct rerere_io * io , int marker_size ) { git_hash_ctx ctx ; struct strbuf buf = STRBUF_INIT , out = STRBUF_INIT ; int has_conflicts = 0 ; if ( hash ) the_hash_algo -> init_fn ( & ctx ) ; while ( ! io -> getline ( & buf , io ) ) { if ( is_cmarker ( buf . buf , ' ' , marker_size ) ) { has_conflicts = handle_conflict ( & out , io , marker_size , hash ? & ctx : NULL ) ; if ( has_conflicts < 0 ) break ; rerere_io_putmem ( out . buf , out . len , io ) ; strbuf_reset ( & out ) ; } else rerere_io_putstr ( buf . buf , io ) ; } strbuf_release ( & buf ) ; strbuf_release ( & out ) ; if ( hash ) the_hash_algo -> final_fn ( hash , & ctx ) ; return has_conflicts ; }
Read contents a file with conflicts, normalize the conflicts
 by (1) discarding the common ancestor version in diff3-style,
 (2) reordering our side and their side so that whichever sorts
 alphabetically earlier comes before the other one, while
 computing the "conflict ID", which is just an SHA-1 hash of
 one side of the conflict, NUL, the other side of the conflict,
 and NUL concatenated together.
Read contents a file with conflicts normalize the conflicts by ( 1 ) discarding the common ancestor version in diff3 - style ( 2 ) reordering our side and their side so that whichever sorts alphabetically earlier comes before the other one while computing the " conflict ID " which is just an SHA - 1 hash of one side of the conflict NUL the other side of the conflict and NUL concatenated together .