Skip to content

Commit 09bdff2

Browse files
bk2204gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4e8161a commit 09bdff2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

diff.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2866,7 +2866,7 @@ void diff_free_filespec_data(struct diff_filespec *s)
28662866
static void prep_temp_blob(const char *path, struct diff_tempfile *temp,
28672867
void *blob,
28682868
unsigned long size,
2869-
const unsigned char *sha1,
2869+
const struct object_id *oid,
28702870
int mode)
28712871
{
28722872
int fd;
@@ -2891,7 +2891,7 @@ static void prep_temp_blob(const char *path, struct diff_tempfile *temp,
28912891
die_errno("unable to write temp-file");
28922892
close_tempfile(&temp->tempfile);
28932893
temp->name = get_tempfile_path(&temp->tempfile);
2894-
sha1_to_hex_r(temp->hex, sha1);
2894+
oid_to_hex_r(temp->hex, oid);
28952895
xsnprintf(temp->mode, sizeof(temp->mode), "%06o", mode);
28962896
strbuf_release(&buf);
28972897
strbuf_release(&template);
@@ -2929,7 +2929,7 @@ static struct diff_tempfile *prepare_temp_file(const char *name,
29292929
die_errno("readlink(%s)", name);
29302930
prep_temp_blob(name, temp, sb.buf, sb.len,
29312931
(one->oid_valid ?
2932-
one->oid.hash : null_sha1),
2932+
&one->oid : &null_oid),
29332933
(one->oid_valid ?
29342934
one->mode : S_IFLNK));
29352935
strbuf_release(&sb);
@@ -2955,7 +2955,7 @@ static struct diff_tempfile *prepare_temp_file(const char *name,
29552955
if (diff_populate_filespec(one, 0))
29562956
die("cannot read data blob for %s", one->path);
29572957
prep_temp_blob(name, temp, one->data, one->size,
2958-
one->oid.hash, one->mode);
2958+
&one->oid, one->mode);
29592959
}
29602960
return temp;
29612961
}

0 commit comments

Comments
 (0)