git-2.22.0/rerere.c
/*
 * $GIT_DIR/MERGE_RR file is a collection of records, each of which is
 * "conflict ID", a HT and pathname, terminated with a NUL, and is
 * used to keep track of the set of paths that "rerere" may need to
 * work on (i.e. what is left by the previous invocation of "git
 * rerere" during the current conflict resolution session).
 */
$GIT_DIR/MERGE_RR file is a collection of records, each of which is
"conflict ID", a HT and pathname, terminated with a NUL, and is
used to keep track of the set of paths that "rerere" may need to
work on .
$GIT_DIR / MERGE_RR file is a collection of records each of which is " conflict ID " a HT and pathname terminated with a NUL and is used to keep track of the set of paths that " rerere " may need to work on .
static void read_rr(struct repository *r, struct string_list *rr)
{
	struct strbuf buf = STRBUF_INIT;
	FILE *in = fopen_or_warn(git_path_merge_rr(r), "r");
	if (!in)
		return;
	while (!strbuf_getwholeline(&buf, in, '\0')) {
		char *path;
		unsigned char hash[GIT_MAX_RAWSZ];
		struct rerere_id *id;
		int variant;
		const unsigned hexsz = the_hash_algo->hexsz;
		if (buf.len < hexsz + 2 || get_sha1_hex(buf.buf, hash))
			die(_("corrupt MERGE_RR"));
		if (buf.buf[hexsz] != '.') {
			variant = 0;
			path = buf.buf + hexsz;
		} else {
			errno = 0;
			variant = strtol(buf.buf + hexsz + 1, &path, 10);
			if (errno)
				die(_("corrupt MERGE_RR"));
		}
		if (*(path++) != '\t')
			die(_("corrupt MERGE_RR"));
		buf.buf[hexsz] = '\0';
		id = new_rerere_id_hex(buf.buf);
		id->variant = variant;
		string_list_insert(rr, path)->util = id;
	}
	strbuf_release(&buf);
	fclose(in);
}
static void read_rr ( struct repository * r , struct string_list * rr ) { struct strbuf buf = STRBUF_INIT ; FILE * in = fopen_or_warn ( git_path_merge_rr ( r ) , " " ) ; if ( ! in ) return ; while ( ! strbuf_getwholeline ( & buf , in , ' \0 ' ) ) { char * path ; unsigned char hash [ GIT_MAX_RAWSZ ] ; struct rerere_id * id ; int variant ; const unsigned hexsz = the_hash_algo -> hexsz ; if ( buf . len < hexsz + 2 || get_sha1_hex ( buf . buf , hash ) ) die ( _ ( " " ) ) ; if ( buf . buf [ hexsz ] != ' ' ) { variant = 0 ; path = buf . buf + hexsz ; } else { errno = 0 ; variant = strtol ( buf . buf + hexsz + 1 , & path , 10 ) ; if ( errno ) die ( _ ( " " ) ) ; } if ( * ( path ++ ) != ' \t ' ) die ( _ ( " " ) ) ; buf . buf [ hexsz ] = ' \0 ' ; id = new_rerere_id_hex ( buf . buf ) ; id -> variant = variant ; string_list_insert ( rr , path ) -> util = id ; } strbuf_release ( & buf ) ; fclose ( in ) ; }
$GIT_DIR/MERGE_RR file is a collection of records, each of which is
 "conflict ID", a HT and pathname, terminated with a NUL, and is
 used to keep track of the set of paths that "rerere" may need to
 work on (i.e.
$GIT_DIR / MERGE_RR file is a collection of records each of which is " conflict ID " a HT and pathname terminated with a NUL and is used to keep track of the set of paths that " rerere " may need to work on ( i . e .
/* There has to be the hash, tab, path and then NUL */