repository: free fields before overwriting them
[gitweb.git] / builtin / add.c
index 5d5773d5cd2fc9e713498a72da7b57b84fd25d19..ef625e3fb8b4f880f85e8a0283ecc18392ce19b6 100644 (file)
@@ -116,8 +116,10 @@ int add_files_to_cache(const char *prefix,
        rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;
        rev.diffopt.format_callback = update_callback;
        rev.diffopt.format_callback_data = &data;
+       rev.diffopt.flags |= DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG;
        rev.max_count = 0; /* do not compare unmerged paths with stage #2 */
        run_diff_files(&rev, DIFF_RACY_IS_MODIFIED);
+       clear_pathspec(&rev.prune_data);
        return !!data.add_errors;
 }