diff: convert prep_temp_blob() to struct object_id

All of the callers of this function use struct object_id, so convert it to use struct object_id in its arguments and internally. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Jun 24, 2016 at 23:09 UTC 09bdff29e1b73ce264c7ddc3e19e1269ee7c610e
1 file changed +4 -4
diff.c
+4 -4
@@ -2866,7 +2866,7 @@ void diff_free_filespec_data(struct diff_filespec *s)
2866 static void prep_temp_blob(const char *path, struct diff_tempfile *temp,
2867 void *blob,
2868 unsigned long size,
2869 - const unsigned char *sha1,
2869 + const struct object_id *oid,
2870 int mode)
2871 {
2872 int fd;
@@ -2891,7 +2891,7 @@ static void prep_temp_blob(const char *path, struct diff_tempfile *temp,
2891 die_errno("unable to write temp-file");
2892 close_tempfile(&temp->tempfile);
2893 temp->name = get_tempfile_path(&temp->tempfile);
2894 - sha1_to_hex_r(temp->hex, sha1);
2894 + oid_to_hex_r(temp->hex, oid);
2895 xsnprintf(temp->mode, sizeof(temp->mode), "%06o", mode);
2896 strbuf_release(&buf);
2897 strbuf_release(&template);
@@ -2929,7 +2929,7 @@ static struct diff_tempfile *prepare_temp_file(const char *name,
2929 die_errno("readlink(%s)", name);
2930 prep_temp_blob(name, temp, sb.buf, sb.len,
2931 (one->oid_valid ?
2932 - one->oid.hash : null_sha1),
2932 + &one->oid : &null_oid),
2933 (one->oid_valid ?
2934 one->mode : S_IFLNK));
2935 strbuf_release(&sb);
@@ -2955,7 +2955,7 @@ static struct diff_tempfile *prepare_temp_file(const char *name,
2955 if (diff_populate_filespec(one, 0))
2956 die("cannot read data blob for %s", one->path);
2957 prep_temp_blob(name, temp, one->data, one->size,
2958 - one->oid.hash, one->mode);
2958 + &one->oid, one->mode);
2959 }
2960 return temp;
2961 }