diff mbox series

[v3,09/26] difftool: ensure full index

Message ID 8c61d40dfe01d89d248ff9208e955801c1a18c18.1618261698.git.gitgitgadget@gmail.com (mailing list archive)
State Accepted
Commit 48b3c7da6c58752b0fbc73e891fd5b24c95281b1
Headers show
Series Sparse Index: API protections | expand

Commit Message

Derrick Stolee April 12, 2021, 9:08 p.m. UTC
From: Derrick Stolee <dstolee@microsoft.com>

Before iterating over all cache entries, ensure that a sparse index has
been expanded to a full one to avoid unexpected behavior.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
 builtin/difftool.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series


diff --git a/builtin/difftool.c b/builtin/difftool.c
index 6e18e623fddf..32c914dde6a0 100644
--- a/builtin/difftool.c
+++ b/builtin/difftool.c
@@ -584,6 +584,9 @@  static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
 		setenv("GIT_DIFFTOOL_DIRDIFF", "true", 1);
 	rc = run_command_v_opt(helper_argv, flags);
+	/* TODO: audit for interaction with sparse-index. */
+	ensure_full_index(&wtindex);
 	 * If the diff includes working copy files and those
 	 * files were modified during the diff, then the changes