revisions API: add a TODO for diff_free(&revs->diffopt)

Add a TODO comment indicating that we should release "diffopt" in
release_revisions(). In a preceding commit we started releasing the
"pruning" member of the same type, but handling "diffopt" will require
us to untangle the "no_free" conditions I added in e900d494dc (diff:
add an API for deferred freeing, 2021-02-11).

Let's leave a TODO comment to that effect, and so that we don't forget
refactor code that was changed to use release_revisions() in earlier
commits to stop using the "diffopt" member after a call to
release_revisions(). This works currently, but would become a logic
error as soon as we started freeing "diffopt". Doing that change now
doesn't harm anything, and future-proofs us against a later change to
release_revisions().

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason
2022-04-14 07:56:40 +02:00
committed by Junio C Hamano
parent ae1b383dfa
commit 54c8a7c379
3 changed files with 8 additions and 3 deletions

View File

@ -2545,8 +2545,9 @@ int has_unstaged_changes(struct repository *r, int ignore_submodules)
rev_info.diffopt.flags.quick = 1;
diff_setup_done(&rev_info.diffopt);
result = run_diff_files(&rev_info, 0);
result = diff_result_code(&rev_info.diffopt, result);
release_revisions(&rev_info);
return diff_result_code(&rev_info.diffopt, result);
return result;
}
/**
@ -2578,8 +2579,9 @@ int has_uncommitted_changes(struct repository *r,
diff_setup_done(&rev_info.diffopt);
result = run_diff_index(&rev_info, 1);
result = diff_result_code(&rev_info.diffopt, result);
release_revisions(&rev_info);
return diff_result_code(&rev_info.diffopt, result);
return result;
}
/**