summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorLibravatar Nguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-08-13 18:14:18 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-08-13 14:14:42 -0700
commitff7fe37b0530c0ddb5a88fe41b963b68b3f66127 (patch)
tree09af0bfce17b3d9658558f7456256505e284bde0 /diff.c
parentsubmodule.h: drop extern from function declaration (diff)
downloadtgif-ff7fe37b0530c0ddb5a88fe41b963b68b3f66127.tar.xz
diff.c: move read_index() code back to the caller
This code is only needed for diff-tree (since f0c6b2a2fd ([PATCH] Optimize diff-tree -[CM] --stdin - 2005-05-27)). Let the caller do the preparation instead and avoid read_index() in diff.c code. read_index() should be avoided (in addition to the_index) because it uses get_index_file() underneath to get the path $GIT_DIR/index. This effectively pulls the_repository in and may become the only reason to pull a 'struct repository *' in diff.c. Let's keep the dependencies as few as possible and kick it back to diff-tree.c Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c10
1 files changed, 0 insertions, 10 deletions
diff --git a/diff.c b/diff.c
index 04d044bbb6..72ce8007fd 100644
--- a/diff.c
+++ b/diff.c
@@ -4414,16 +4414,6 @@ void diff_setup_done(struct diff_options *options)
if (options->detect_rename && options->rename_limit < 0)
options->rename_limit = diff_rename_limit_default;
- if (options->setup & DIFF_SETUP_USE_CACHE) {
- if (!active_cache)
- /* read-cache does not die even when it fails
- * so it is safe for us to do this here. Also
- * it does not smudge active_cache or active_nr
- * when it fails, so we do not have to worry about
- * cleaning it up ourselves either.
- */
- read_cache();
- }
if (hexsz < options->abbrev)
options->abbrev = hexsz; /* full */