Browse Source

revisions API: have release_revisions() release "prune_data"

Extend the the release_revisions() function so that it frees the
"prune_data" in the "struct rev_info". This means that any code that
calls "release_revisions()" already can get rid of adjacent calls to
clear_pathspec().

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pull/1281/merge
Ævar Arnfjörð Bjarmason 4 months ago committed by Junio C Hamano
parent
commit
689a8e80dd
  1. 2
      add-interactive.c
  2. 1
      builtin/add.c
  3. 2
      builtin/stash.c
  4. 1
      diff-lib.c
  5. 1
      revision.c
  6. 2
      wt-status.c

2
add-interactive.c

@ -568,8 +568,6 @@ static int get_modified_files(struct repository *r,
run_diff_files(&rev, 0);
}
if (ps)
clear_pathspec(&rev.prune_data);
release_revisions(&rev);
}
hashmap_clear_and_free(&s.file_map, struct pathname_entry, ent);

1
builtin/add.c

@ -142,7 +142,6 @@ int add_files_to_cache(const char *prefix,
rev.diffopt.flags.override_submodule_config = 1;
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);
release_revisions(&rev);
return !!data.add_errors;
}

2
builtin/stash.c

@ -1064,7 +1064,6 @@ static int check_changes_tracked_files(const struct pathspec *ps)
}
done:
clear_pathspec(&rev.prune_data);
release_revisions(&rev);
return ret;
}
@ -1276,7 +1275,6 @@ static int stash_working_tree(struct stash_info *info, const struct pathspec *ps
done:
discard_index(&istate);
clear_pathspec(&rev.prune_data);
release_revisions(&rev);
strbuf_release(&diff_output);
remove_path(stash_index_path.buf);

1
diff-lib.c

@ -641,7 +641,6 @@ 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;
}

1
revision.c

@ -2949,6 +2949,7 @@ void release_revisions(struct rev_info *revs)
object_array_clear(&revs->pending);
release_revisions_cmdline(&revs->cmdline);
list_objects_filter_release(&revs->filter);
clear_pathspec(&revs->prune_data);
release_revisions_mailmap(revs->mailmap);
free_grep_patterns(&revs->grep_filter);
}

2
wt-status.c

@ -616,7 +616,6 @@ static void wt_status_collect_changes_worktree(struct wt_status *s)
rev.diffopt.rename_score = s->rename_score >= 0 ? s->rename_score : rev.diffopt.rename_score;
copy_pathspec(&rev.prune_data, &s->pathspec);
run_diff_files(&rev, 0);
clear_pathspec(&rev.prune_data);
release_revisions(&rev);
}
@ -664,7 +663,6 @@ static void wt_status_collect_changes_index(struct wt_status *s)
copy_pathspec(&rev.prune_data, &s->pathspec);
run_diff_index(&rev, 1);
release_revisions(&rev);
clear_pathspec(&rev.prune_data);
}
static int add_file_to_list(const struct object_id *oid,

Loading…
Cancel
Save