diff mbox series

[09/27] difftool: ensure full index

Message ID 83040e7558f3effac91e76352f259a5a7d367ed8.1615929436.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series Sparse Index: API protections | expand

Commit Message

Derrick Stolee March 16, 2021, 9:16 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 | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/builtin/difftool.c b/builtin/difftool.c
index 6e18e623fddf..1d62f77efa61 100644
--- a/builtin/difftool.c
+++ b/builtin/difftool.c
@@ -584,6 +584,8 @@  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);
 
+	ensure_full_index(&wtindex);
+
 	/*
 	 * If the diff includes working copy files and those
 	 * files were modified during the diff, then the changes