- status = parse_diff_raw(sb1.buf+1, sb2.buf, sb3.buf);
- }
- else
- status = parse_diff_raw(sb1.buf+1, NULL, NULL);
- if (status) {
- unrecognized:
- diff_flush(diff_output_style);
- printf("%s%c", sb1.buf, line_termination);
+ if (get_sha1_hex(cp, old_sha1))
+ break;
+ cp += 40;
+ if (*cp++ != ' ')
+ break;
+ if (get_sha1_hex(cp, new_sha1))
+ break;
+ cp += 40;
+ if (*cp++ != ' ')
+ break;
+ status = *cp++;
+ if (!strchr("MCRNDU", status))
+ break;
+ two_paths = score = 0;
+ if (status == DIFF_STATUS_RENAMED ||
+ status == DIFF_STATUS_COPIED)
+ two_paths = 1;
+
+ /* pick up score if exists */
+ if (sscanf(cp, "%d", &score) != 1)
+ score = 0;
+ cp = strchr(cp,
+ inter_name_termination);
+ if (!cp)
+ break;
+ if (*cp++ != inter_name_termination)
+ break;
+
+ /* first pathname */
+ if (!line_termination) {
+ read_line(&sb, stdin, line_termination);
+ if (sb.eof)
+ break;
+ strcpy(old_path, sb.buf);
+ }
+ else if (!two_paths)
+ strcpy(old_path, cp);
+ else {
+ ep = strchr(cp, inter_name_termination);
+ if (!ep)
+ break;
+ strncpy(old_path, cp, ep-cp);
+ old_path[ep-cp] = 0;
+ cp = ep + 1;
+ }
+
+ /* second pathname */
+ if (!two_paths)
+ strcpy(new_path, old_path);
+ else {
+ if (!line_termination) {
+ read_line(&sb, stdin,
+ line_termination);
+ if (sb.eof)
+ break;
+ strcpy(new_path, sb.buf);
+ }
+ else
+ strcpy(new_path, cp);
+ }
+ diff_helper_input(old_mode, new_mode,
+ old_sha1, new_sha1,
+ old_path, status, score,
+ new_path);
+ continue;