compat/poll: sleep 1 millisecond to avoid busy wait
[gitweb.git] / diff-lib.c
index b6f4b21637fe66a614a0dd6581f90fc12e80a6f8..2eddc66bbd5cf37e4649e219a28c951ed134557c 100644 (file)
@@ -11,6 +11,7 @@
 #include "unpack-trees.h"
 #include "refs.h"
 #include "submodule.h"
+#include "dir.h"
 
 /*
  * diff-files
@@ -87,10 +88,12 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
 {
        int entries, i;
        int diff_unmerged_stage = revs->max_count;
-       int silent_on_removed = option & DIFF_SILENT_ON_REMOVED;
        unsigned ce_option = ((option & DIFF_RACY_IS_MODIFIED)
                              ? CE_MATCH_RACY_IS_DIRTY : 0);
 
+       if (option & DIFF_SILENT_ON_REMOVED)
+               handle_deprecated_show_diff_q(&revs->diffopt);
+
        diff_set_mnemonic_prefix(&revs->diffopt, "i/", "w/");
 
        if (diff_unmerged_stage < 0)
@@ -106,7 +109,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
                if (diff_can_quit_early(&revs->diffopt))
                        break;
 
-               if (!ce_path_match(ce, &revs->prune_data))
+               if (!ce_path_match(ce, &revs->prune_data, NULL))
                        continue;
 
                if (ce_stage(ce)) {
@@ -137,8 +140,6 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
                                        perror(ce->name);
                                        continue;
                                }
-                               if (silent_on_removed)
-                                       continue;
                                wt_mode = 0;
                        }
                        dpath->mode = wt_mode;
@@ -204,8 +205,6 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
                                perror(ce->name);
                                continue;
                        }
-                       if (silent_on_removed)
-                               continue;
                        diff_addremove(&revs->diffopt, '-', ce->ce_mode,
                                       ce->sha1, !is_null_sha1(ce->sha1),
                                       ce->name, 0);
@@ -440,7 +439,7 @@ static int oneway_diff(const struct cache_entry * const *src,
        if (tree == o->df_conflict_entry)
                tree = NULL;
 
-       if (ce_path_match(idx ? idx : tree, &revs->prune_data)) {
+       if (ce_path_match(idx ? idx : tree, &revs->prune_data, NULL)) {
                do_oneway_diff(o, idx, tree);
                if (diff_can_quit_early(&revs->diffopt)) {
                        o->exiting_early = 1;
@@ -476,7 +475,6 @@ static int diff_cache(struct rev_info *revs,
        opts.dst_index = NULL;
        opts.pathspec = &revs->diffopt.pathspec;
        opts.pathspec->recursive = 1;
-       opts.pathspec->max_depth = -1;
 
        init_tree_desc(&t, tree->buffer, tree->size);
        return unpack_trees(1, &t, &opts);
@@ -502,7 +500,7 @@ int do_diff_cache(const unsigned char *tree_sha1, struct diff_options *opt)
        struct rev_info revs;
 
        init_revisions(&revs, NULL);
-       init_pathspec(&revs.prune_data, opt->pathspec.raw);
+       copy_pathspec(&revs.prune_data, &opt->pathspec);
        revs.diffopt = *opt;
 
        if (diff_cache(&revs, tree_sha1, NULL, 1))