Code

Add a few more tests for git-commit
[git.git] / builtin-diff.c
index f557d21929fe3df018f30e68c7943ead7f8eb4a1..1b615991e1fc6aaa329811cc9f7b615e20b00917 100644 (file)
@@ -35,7 +35,7 @@ static void stuff_change(struct diff_options *opt,
            !hashcmp(old_sha1, new_sha1) && (old_mode == new_mode))
                return;
 
-       if (opt->reverse_diff) {
+       if (DIFF_OPT_TST(opt, REVERSE_DIFF)) {
                unsigned tmp;
                const unsigned char *tmp_u;
                const char *tmp_c;
@@ -253,13 +253,13 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
                if (diff_setup_done(&rev.diffopt) < 0)
                        die("diff_setup_done failed");
        }
-       rev.diffopt.allow_external = 1;
-       rev.diffopt.recursive = 1;
+       DIFF_OPT_SET(&rev.diffopt, ALLOW_EXTERNAL);
+       DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
 
        /* If the user asked for our exit code then don't start a
         * pager or we would end up reporting its exit code instead.
         */
-       if (!rev.diffopt.exit_with_status)
+       if (!DIFF_OPT_TST(&rev.diffopt, EXIT_WITH_STATUS))
                setup_pager();
 
        /* Do we have --cached and not have a pending object, then
@@ -363,8 +363,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
        else
                result = builtin_diff_combined(&rev, argc, argv,
                                             ent, ents);
-       if (rev.diffopt.exit_with_status)
-               result = rev.diffopt.has_changes;
+       if (DIFF_OPT_TST(&rev.diffopt, EXIT_WITH_STATUS))
+               result = DIFF_OPT_TST(&rev.diffopt, HAS_CHANGES) != 0;
 
        if (1 < rev.diffopt.skip_stat_unmatch)
                refresh_index_quietly();