Convert read_mmblob to take struct object_id.
Since all of its callers have been updated, convert read_mmblob to take a pointer to 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:08 UTC
d449347d080cd97a9d6dc029014383d4817e34bf
6 files changed
+18
-17
builtin/apply.c
+3
-3
@@ -3435,9 +3435,9 @@ static int three_way_merge(struct image *image,
3435
mmbuffer_t result = { NULL };
3436
int status;
3437
3438
- read_mmblob(&base_file, base->hash);
3439
- read_mmblob(&our_file, ours->hash);
3440
- read_mmblob(&their_file, theirs->hash);
3438
+ read_mmblob(&base_file, base);
3439
+ read_mmblob(&our_file, ours);
3440
+ read_mmblob(&their_file, theirs);
3441
status = ll_merge(&result, path,
3442
&base_file, "base",
3443
&our_file, "ours",
builtin/checkout.c
+3
-3
@@ -195,9 +195,9 @@ static int checkout_merged(int pos, struct checkout *state)
195
if (is_null_oid(&threeway[1]) || is_null_oid(&threeway[2]))
196
return error(_("path '%s' does not have necessary versions"), path);
197
198
- read_mmblob(&ancestor, threeway[0].hash);
199
- read_mmblob(&ours, threeway[1].hash);
200
- read_mmblob(&theirs, threeway[2].hash);
198
+ read_mmblob(&ancestor, &threeway[0]);
199
+ read_mmblob(&ours, &threeway[1]);
200
+ read_mmblob(&theirs, &threeway[2]);
201
202
/*
203
* NEEDSWORK: re-create conflicts from merges with
merge-recursive.c
+3
-3
@@ -910,9 +910,9 @@ static int merge_3way(struct merge_options *o,
910
name2 = mkpathdup("%s", branch2);
911
}
912
913
- read_mmblob(&orig, one->oid.hash);
914
- read_mmblob(&src1, a->oid.hash);
915
- read_mmblob(&src2, b->oid.hash);
913
+ read_mmblob(&orig, &one->oid);
914
+ read_mmblob(&src1, &a->oid);
915
+ read_mmblob(&src2, &b->oid);
916
917
merge_status = ll_merge(result_buf, a->path, &orig, base_name,
918
&src1, name1, &src2, name2, &ll_opts);
notes-merge.c
+3
-3
@@ -344,9 +344,9 @@ static int ll_merge_in_worktree(struct notes_merge_options *o,
344
mmfile_t base, local, remote;
345
int status;
346
347
- read_mmblob(&base, p->base.hash);
348
- read_mmblob(&local, p->local.hash);
349
- read_mmblob(&remote, p->remote.hash);
347
+ read_mmblob(&base, &p->base);
348
+ read_mmblob(&local, &p->local);
349
+ read_mmblob(&remote, &p->remote);
350
351
status = ll_merge(&result_buf, oid_to_hex(&p->obj), &base, NULL,
352
&local, o->local_ref, &remote, o->remote_ref, NULL);
xdiff-interface.c
+4
-4
@@ -178,20 +178,20 @@ int read_mmfile(mmfile_t *ptr, const char *filename)
178
return 0;
179
}
180
181
-void read_mmblob(mmfile_t *ptr, const unsigned char *sha1)
181
+void read_mmblob(mmfile_t *ptr, const struct object_id *oid)
182
{
183
unsigned long size;
184
enum object_type type;
185
186
- if (!hashcmp(sha1, null_sha1)) {
186
+ if (!oidcmp(oid, &null_oid)) {
187
ptr->ptr = xstrdup("");
188
ptr->size = 0;
189
return;
190
}
191
192
- ptr->ptr = read_sha1_file(sha1, &type, &size);
192
+ ptr->ptr = read_sha1_file(oid->hash, &type, &size);
193
if (!ptr->ptr || type != OBJ_BLOB)
194
- die("unable to read blob object %s", sha1_to_hex(sha1));
194
+ die("unable to read blob object %s", oid_to_hex(oid));
195
ptr->size = size;
196
}
197
xdiff-interface.h
+2
-1
@@ -1,6 +1,7 @@
1
#ifndef XDIFF_INTERFACE_H
2
#define XDIFF_INTERFACE_H
3
4
+#include "cache.h"
5
#include "xdiff/xdiff.h"
6
7
/*
@@ -20,7 +21,7 @@ int parse_hunk_header(char *line, int len,
21
int *ob, int *on,
22
int *nb, int *nn);
23
int read_mmfile(mmfile_t *ptr, const char *filename);
23
-void read_mmblob(mmfile_t *ptr, const unsigned char *sha1);
24
+void read_mmblob(mmfile_t *ptr, const struct object_id *oid);
25
int buffer_is_binary(const char *ptr, unsigned long size);
26
27
extern void xdiff_set_find_func(xdemitconf_t *xecfg, const char *line, int cflags);