ls-files: convert show_files to take an index
[gitweb.git] / builtin / diff.c
index 1a1149eed44a27d162f6e17bfb9221e58dca68fd..0c8f86e40da6537d57f5ed6ca0ecdd005e29c8f5 100644 (file)
@@ -90,7 +90,8 @@ static int builtin_diff_b_f(struct rev_info *revs,
                     blob[0]->mode, canon_mode(st.st_mode),
                     &blob[0]->item->oid, &null_oid,
                     1, 0,
-                    path, path);
+                    blob[0]->path ? blob[0]->path : path,
+                    path);
        diffcore_std(&revs->diffopt);
        diff_flush(&revs->diffopt);
        return 0;
@@ -380,7 +381,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
                                add_head_to_pending(&rev);
                                if (!rev.pending.nr) {
                                        struct tree *tree;
-                                       tree = lookup_tree(EMPTY_TREE_SHA1_BIN);
+                                       tree = lookup_tree(&empty_tree_oid);
                                        add_pending_object(&rev, &tree->object, "HEAD");
                                }
                                break;
@@ -394,7 +395,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
                const char *name = entry->name;
                int flags = (obj->flags & UNINTERESTING);
                if (!obj->parsed)
-                       obj = parse_object(obj->oid.hash);
+                       obj = parse_object(&obj->oid);
                obj = deref_tag(obj, NULL, 0);
                if (!obj)
                        die(_("invalid object '%s' given."), name);