Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
diff: convert prep_temp_blob() to struct object_id
author
brian m. carlson
<sandals@crustytoothpaste.net>
Fri, 24 Jun 2016 23:09:29 +0000
(23:09 +0000)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 28 Jun 2016 18:39:02 +0000
(11:39 -0700)
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>
diff.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
4e8161a
)
diff --git
a/diff.c
b/diff.c
index 9abb54ad20cbce24d7737b2e8bc79c3ddbde3496..8cdfdf32225102a8bfdb15c5e3551ee5956f5911 100644
(file)
--- a/
diff.c
+++ b/
diff.c
@@
-2866,7
+2866,7
@@
void diff_free_filespec_data(struct diff_filespec *s)
static void prep_temp_blob(const char *path, struct diff_tempfile *temp,
void *blob,
unsigned long size,
static void prep_temp_blob(const char *path, struct diff_tempfile *temp,
void *blob,
unsigned long size,
- const
unsigned char *sha1
,
+ const
struct object_id *oid
,
int mode)
{
int fd;
int mode)
{
int fd;
@@
-2891,7
+2891,7
@@
static void prep_temp_blob(const char *path, struct diff_tempfile *temp,
die_errno("unable to write temp-file");
close_tempfile(&temp->tempfile);
temp->name = get_tempfile_path(&temp->tempfile);
die_errno("unable to write temp-file");
close_tempfile(&temp->tempfile);
temp->name = get_tempfile_path(&temp->tempfile);
-
sha1_to_hex_r(temp->hex, sha1
);
+
oid_to_hex_r(temp->hex, oid
);
xsnprintf(temp->mode, sizeof(temp->mode), "%06o", mode);
strbuf_release(&buf);
strbuf_release(&template);
xsnprintf(temp->mode, sizeof(temp->mode), "%06o", mode);
strbuf_release(&buf);
strbuf_release(&template);
@@
-2929,7
+2929,7
@@
static struct diff_tempfile *prepare_temp_file(const char *name,
die_errno("readlink(%s)", name);
prep_temp_blob(name, temp, sb.buf, sb.len,
(one->oid_valid ?
die_errno("readlink(%s)", name);
prep_temp_blob(name, temp, sb.buf, sb.len,
(one->oid_valid ?
-
one->oid.hash : null_sha1
),
+
&one->oid : &null_oid
),
(one->oid_valid ?
one->mode : S_IFLNK));
strbuf_release(&sb);
(one->oid_valid ?
one->mode : S_IFLNK));
strbuf_release(&sb);
@@
-2955,7
+2955,7
@@
static struct diff_tempfile *prepare_temp_file(const char *name,
if (diff_populate_filespec(one, 0))
die("cannot read data blob for %s", one->path);
prep_temp_blob(name, temp, one->data, one->size,
if (diff_populate_filespec(one, 0))
die("cannot read data blob for %s", one->path);
prep_temp_blob(name, temp, one->data, one->size,
-
one->oid.hash
, one->mode);
+
&one->oid
, one->mode);
}
return temp;
}
}
return temp;
}