builtin: convert textconv_object to use struct object_id

Since all of its callers have been updated, make textconv_object take a struct object_id. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Sep 5, 2016 at 20:07 UTC acad70d10687ce0fb269411e3a4b3b8fd11c6007
4 files changed +9 -9
builtin.h
+1 -1
@@ -25,7 +25,7 @@ struct fmt_merge_msg_opts {
25 extern int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
26 struct fmt_merge_msg_opts *);
27
28 -extern int textconv_object(const char *path, unsigned mode, const unsigned char *sha1, int sha1_valid, char **buf, unsigned long *buf_size);
28 +extern int textconv_object(const char *path, unsigned mode, const struct object_id *oid, int oid_valid, char **buf, unsigned long *buf_size);
29
30 extern int is_builtin(const char *s);
31
builtin/blame.c
+6 -6
@@ -154,8 +154,8 @@ static int diff_hunks(mmfile_t *file_a, mmfile_t *file_b,
154 */
155 int textconv_object(const char *path,
156 unsigned mode,
157 - const unsigned char *sha1,
158 - int sha1_valid,
157 + const struct object_id *oid,
158 + int oid_valid,
159 char **buf,
160 unsigned long *buf_size)
161 {
@@ -163,7 +163,7 @@ int textconv_object(const char *path,
163 struct userdiff_driver *textconv;
164
165 df = alloc_filespec(path);
166 - fill_filespec(df, sha1, sha1_valid, mode);
166 + fill_filespec(df, oid->hash, oid_valid, mode);
167 textconv = get_textconv(df);
168 if (!textconv) {
169 free_filespec(df);
@@ -188,7 +188,7 @@ static void fill_origin_blob(struct diff_options *opt,
188
189 num_read_blob++;
190 if (DIFF_OPT_TST(opt, ALLOW_TEXTCONV) &&
191 - textconv_object(o->path, o->mode, o->blob_oid.hash, 1, &file->ptr, &file_size))
191 + textconv_object(o->path, o->mode, &o->blob_oid, 1, &file->ptr, &file_size))
192 ;
193 else
194 file->ptr = read_sha1_file(o->blob_oid.hash, &type,
@@ -2366,7 +2366,7 @@ static struct commit *fake_working_tree_commit(struct diff_options *opt,
2366 switch (st.st_mode & S_IFMT) {
2367 case S_IFREG:
2368 if (DIFF_OPT_TST(opt, ALLOW_TEXTCONV) &&
2369 - textconv_object(read_from, mode, null_sha1, 0, &buf_ptr, &buf_len))
2369 + textconv_object(read_from, mode, &null_oid, 0, &buf_ptr, &buf_len))
2370 strbuf_attach(&buf, buf_ptr, buf_len, buf_len + 1);
2371 else if (strbuf_read_file(&buf, read_from, st.st_size) != st.st_size)
2372 die_errno("cannot open or read '%s'", read_from);
@@ -2793,7 +2793,7 @@ parse_done:
2793 die("no such path %s in %s", path, final_commit_name);
2794
2795 if (DIFF_OPT_TST(&sb.revs->diffopt, ALLOW_TEXTCONV) &&
2796 - textconv_object(path, o->mode, o->blob_oid.hash, 1, (char **) &sb.final_buf,
2796 + textconv_object(path, o->mode, &o->blob_oid, 1, (char **) &sb.final_buf,
2797 &sb.final_buf_size))
2798 ;
2799 else
builtin/cat-file.c
+1 -1
@@ -66,7 +66,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
66 die("git cat-file --textconv %s: <object> must be <sha1:path>",
67 obj_name);
68
69 - if (textconv_object(obj_context.path, obj_context.mode, oid.hash, 1, &buf, &size))
69 + if (textconv_object(obj_context.path, obj_context.mode, &oid, 1, &buf, &size))
70 break;
71
72 case 'p':
builtin/log.c
+1 -1
@@ -479,7 +479,7 @@ static int show_blob_object(const struct object_id *oid, struct rev_info *rev, c
479 if (get_sha1_with_context(obj_name, 0, oidc.hash, &obj_context))
480 die(_("Not a valid object name %s"), obj_name);
481 if (!obj_context.path[0] ||
482 - !textconv_object(obj_context.path, obj_context.mode, oidc.hash, 1, &buf, &size))
482 + !textconv_object(obj_context.path, obj_context.mode, &oidc, 1, &buf, &size))
483 return stream_blob_to_fd(1, oid->hash, NULL, 0);
484
485 if (!buf)