am: improve author-script error reporting
[gitweb.git] / builtin / diff.c
index bfefff3a84896a79fbed42eec1121286edcc86dd..b3a8ba488ff824e2feda6b24df362f662fe5ddde 100644 (file)
@@ -41,7 +41,7 @@ static void stuff_change(struct diff_options *opt,
        struct diff_filespec *one, *two;
 
        if (!is_null_oid(old_oid) && !is_null_oid(new_oid) &&
-           !oidcmp(old_oid, new_oid) && (old_mode == new_mode))
+           oideq(old_oid, new_oid) && (old_mode == new_mode))
                return;
 
        if (opt->flags.reverse_diff) {
@@ -352,6 +352,13 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
        rev.diffopt.flags.allow_external = 1;
        rev.diffopt.flags.allow_textconv = 1;
 
+       /*
+        * Default to intent-to-add entries invisible in the
+        * index. This makes them show up as new files in diff-files
+        * and not at all in diff-cached.
+        */
+       rev.diffopt.ita_invisible_in_index = 1;
+
        if (nongit)
                die(_("Not a git repository"));
        argc = setup_revisions(argc, argv, &rev, NULL);
@@ -379,7 +386,8 @@ 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(the_hash_algo->empty_tree);
+                                       tree = lookup_tree(the_repository,
+                                                          the_repository->hash_algo->empty_tree);
                                        add_pending_object(&rev, &tree->object, "HEAD");
                                }
                                break;
@@ -393,8 +401,8 @@ 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);
-               obj = deref_tag(obj, NULL, 0);
+                       obj = parse_object(the_repository, &obj->oid);
+               obj = deref_tag(the_repository, obj, NULL, 0);
                if (!obj)
                        die(_("invalid object '%s' given."), name);
                if (obj->type == OBJ_COMMIT)