summaryrefslogtreecommitdiff
path: root/diff-lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'diff-lib.c')
-rw-r--r--diff-lib.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/diff-lib.c b/diff-lib.c
index ca085a03ef..2edea41a23 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -466,6 +466,11 @@ static void do_oneway_diff(struct unpack_trees_options *o,
* Something removed from the tree?
*/
if (!idx) {
+ if (S_ISSPARSEDIR(tree->ce_mode)) {
+ diff_tree_oid(&tree->oid, NULL, tree->name, &revs->diffopt);
+ return;
+ }
+
diff_index_show_file(revs, "-", tree, &tree->oid, 1,
tree->ce_mode, 0);
return;
@@ -641,7 +646,7 @@ int do_diff_cache(const struct object_id *tree_oid, struct diff_options *opt)
if (diff_cache(&revs, tree_oid, NULL, 1))
exit(128);
- clear_pathspec(&revs.prune_data);
+ release_revisions(&revs);
return 0;
}
@@ -651,6 +656,7 @@ int index_differs_from(struct repository *r,
{
struct rev_info rev;
struct setup_revision_opt opt;
+ unsigned has_changes;
repo_init_revisions(r, &rev, NULL);
memset(&opt, 0, sizeof(opt));
@@ -662,8 +668,9 @@ int index_differs_from(struct repository *r,
diff_flags_or(&rev.diffopt.flags, flags);
rev.diffopt.ita_invisible_in_index = ita_invisible_in_index;
run_diff_index(&rev, 1);
- object_array_clear(&rev.pending);
- return (rev.diffopt.flags.has_changes != 0);
+ has_changes = rev.diffopt.flags.has_changes;
+ release_revisions(&rev);
+ return (has_changes != 0);
}
static struct strbuf *idiff_prefix_cb(struct diff_options *opt, void *data)