Skip to content

Commit 689a8e8

Browse files
avargitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f41fb66 commit 689a8e8

File tree

6 files changed

+1
-8
lines changed

6 files changed

+1
-8
lines changed

add-interactive.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,6 @@ static int get_modified_files(struct repository *r,
568568
run_diff_files(&rev, 0);
569569
}
570570

571-
if (ps)
572-
clear_pathspec(&rev.prune_data);
573571
release_revisions(&rev);
574572
}
575573
hashmap_clear_and_free(&s.file_map, struct pathname_entry, ent);

builtin/add.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ int add_files_to_cache(const char *prefix,
142142
rev.diffopt.flags.override_submodule_config = 1;
143143
rev.max_count = 0; /* do not compare unmerged paths with stage #2 */
144144
run_diff_files(&rev, DIFF_RACY_IS_MODIFIED);
145-
clear_pathspec(&rev.prune_data);
146145
release_revisions(&rev);
147146
return !!data.add_errors;
148147
}

builtin/stash.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,6 @@ static int check_changes_tracked_files(const struct pathspec *ps)
10641064
}
10651065

10661066
done:
1067-
clear_pathspec(&rev.prune_data);
10681067
release_revisions(&rev);
10691068
return ret;
10701069
}
@@ -1276,7 +1275,6 @@ static int stash_working_tree(struct stash_info *info, const struct pathspec *ps
12761275

12771276
done:
12781277
discard_index(&istate);
1279-
clear_pathspec(&rev.prune_data);
12801278
release_revisions(&rev);
12811279
strbuf_release(&diff_output);
12821280
remove_path(stash_index_path.buf);

diff-lib.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,6 @@ int do_diff_cache(const struct object_id *tree_oid, struct diff_options *opt)
641641

642642
if (diff_cache(&revs, tree_oid, NULL, 1))
643643
exit(128);
644-
clear_pathspec(&revs.prune_data);
645644
release_revisions(&revs);
646645
return 0;
647646
}

revision.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2949,6 +2949,7 @@ void release_revisions(struct rev_info *revs)
29492949
object_array_clear(&revs->pending);
29502950
release_revisions_cmdline(&revs->cmdline);
29512951
list_objects_filter_release(&revs->filter);
2952+
clear_pathspec(&revs->prune_data);
29522953
release_revisions_mailmap(revs->mailmap);
29532954
free_grep_patterns(&revs->grep_filter);
29542955
}

wt-status.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,6 @@ static void wt_status_collect_changes_worktree(struct wt_status *s)
616616
rev.diffopt.rename_score = s->rename_score >= 0 ? s->rename_score : rev.diffopt.rename_score;
617617
copy_pathspec(&rev.prune_data, &s->pathspec);
618618
run_diff_files(&rev, 0);
619-
clear_pathspec(&rev.prune_data);
620619
release_revisions(&rev);
621620
}
622621

@@ -664,7 +663,6 @@ static void wt_status_collect_changes_index(struct wt_status *s)
664663
copy_pathspec(&rev.prune_data, &s->pathspec);
665664
run_diff_index(&rev, 1);
666665
release_revisions(&rev);
667-
clear_pathspec(&rev.prune_data);
668666
}
669667

670668
static int add_file_to_list(const struct object_id *oid,

0 commit comments

Comments
 (0)