push: better error message when no remote configured
[git.git] / diff-lib.c
index 8b8978ae6d1b4d947952b7fe9ec9cea013aaa8c3..1e22992cb10420b9dd6def16f80efc5f196ffbbb 100644 (file)
@@ -68,11 +68,16 @@ static int match_stat_with_submodule(struct diff_options *diffopt,
                                      unsigned ce_option, unsigned *dirty_submodule)
 {
        int changed = ce_match_stat(ce, st, ce_option);
-       if (S_ISGITLINK(ce->ce_mode)
-           && !DIFF_OPT_TST(diffopt, IGNORE_SUBMODULES)
-           && !DIFF_OPT_TST(diffopt, IGNORE_DIRTY_SUBMODULES)
-           && (!changed || DIFF_OPT_TST(diffopt, DIRTY_SUBMODULES))) {
-               *dirty_submodule = is_submodule_modified(ce->name, DIFF_OPT_TST(diffopt, IGNORE_UNTRACKED_IN_SUBMODULES));
+       if (S_ISGITLINK(ce->ce_mode)) {
+               unsigned orig_flags = diffopt->flags;
+               if (!DIFF_OPT_TST(diffopt, OVERRIDE_SUBMODULE_CONFIG))
+                       set_diffopt_flags_from_submodule_config(diffopt, ce->name);
+               if (DIFF_OPT_TST(diffopt, IGNORE_SUBMODULES))
+                       changed = 0;
+               else if (!DIFF_OPT_TST(diffopt, IGNORE_DIRTY_SUBMODULES)
+                   && (!changed || DIFF_OPT_TST(diffopt, DIRTY_SUBMODULES)))
+                       *dirty_submodule = is_submodule_modified(ce->name, DIFF_OPT_TST(diffopt, IGNORE_UNTRACKED_IN_SUBMODULES));
+               diffopt->flags = orig_flags;
        }
        return changed;
 }
@@ -101,7 +106,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
                        DIFF_OPT_TST(&revs->diffopt, HAS_CHANGES))
                        break;
 
-               if (!ce_path_match(ce, revs->prune_data))
+               if (!ce_path_match(ce, &revs->prune_data))
                        continue;
 
                if (ce_stage(ce)) {
@@ -422,7 +427,7 @@ static int oneway_diff(struct cache_entry **src, struct unpack_trees_options *o)
        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))
                do_oneway_diff(o, idx, tree);
 
        return 0;
@@ -496,7 +501,7 @@ int do_diff_cache(const unsigned char *tree_sha1, struct diff_options *opt)
        active_nr = dst - active_cache;
 
        init_revisions(&revs, NULL);
-       revs.prune_data = opt->paths;
+       init_pathspec(&revs.prune_data, opt->pathspec.raw);
        tree = parse_tree_indirect(tree_sha1);
        if (!tree)
                die("bad tree object %s", sha1_to_hex(tree_sha1));