stuff_change(&revs->diffopt,
canon_mode(st.st_mode), canon_mode(st.st_mode),
blob[0].sha1, null_sha1,
- blob[0].name, path);
+ path, path);
diffcore_std(&revs->diffopt);
diff_flush(&revs->diffopt);
return 0;
int argc, const char **argv,
struct blobinfo *blob)
{
- /* Blobs */
+ /* Blobs: the arguments are reversed when setup_revisions()
+ * picked them up.
+ */
unsigned mode = canon_mode(S_IFREG | 0644);
while (1 < argc) {
}
stuff_change(&revs->diffopt,
mode, mode,
- blob[0].sha1, blob[1].sha1,
- blob[1].name, blob[1].name);
+ blob[1].sha1, blob[0].sha1,
+ blob[0].name, blob[0].name);
diffcore_std(&revs->diffopt);
diff_flush(&revs->diffopt);
return 0;
return 0;
}
-static void add_head(struct rev_info *revs)
+void add_head(struct rev_info *revs)
{
unsigned char sha1[20];
struct object *obj;
obj = deref_tag(obj, NULL, 0);
if (!obj)
die("invalid object '%s' given.", name);
- if (!strcmp(obj->type, commit_type))
+ if (obj->type == TYPE_COMMIT)
obj = &((struct commit *)obj)->tree->object;
- if (!strcmp(obj->type, tree_type)) {
+ if (obj->type == TYPE_TREE) {
if (ARRAY_SIZE(ent) <= ents)
die("more than %d trees given: '%s'",
(int) ARRAY_SIZE(ent), name);
ents++;
continue;
}
- if (!strcmp(obj->type, blob_type)) {
+ if (obj->type == TYPE_BLOB) {
if (2 <= blobs)
die("more than two blobs given: '%s'", name);
memcpy(blob[blobs].sha1, obj->sha1, 20);