summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2017-12-06 22:02:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-12-06 22:49:18 (GMT)
commitfd66bcc31ff294cdeaa3e960a3aa7fee619ec3b8 (patch)
treeed749282b4966ecb3b063b4294cf311ebccf3e82 /builtin
parent557a5998df19faf8641acfc5b6b1c3c2ba64dca9 (diff)
downloadgit-fd66bcc31ff294cdeaa3e960a3aa7fee619ec3b8.zip
git-fd66bcc31ff294cdeaa3e960a3aa7fee619ec3b8.tar.gz
git-fd66bcc31ff294cdeaa3e960a3aa7fee619ec3b8.tar.bz2
diff-tree: read the index so attribute checks work in bare repositories
A regression was introduced in 557a5998d (submodule: remove gitmodules_config, 2017-08-03) to how attribute processing was handled in bare repositories when running the diff-tree command. By default the attribute system will first try to read ".gitattribute" files from the working tree and then falls back to reading them from the index if there isn't a copy checked out in the worktree. Prior to 557a5998d the index was read as a side effect of the call to 'gitmodules_config()' which ensured that the index was already populated before entering the attribute subsystem. Since the call to 'gitmodules_config()' was removed the index is no longer being read so when the attribute system tries to read from the in-memory index it doesn't find any ".gitattribute" entries effectively ignoring any configured attributes. Fix this by explicitly reading the index during the setup of diff-tree. Reported-by: Ben Boeckel <ben.boeckel@kitware.com> Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/diff-tree.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index d664999..b775a75 100644
--- a/builtin/diff-tree.c
+++ b/builtin/diff-tree.c
@@ -110,6 +110,8 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
init_revisions(opt, prefix);
+ if (read_cache() < 0)
+ die(_("index file corrupt"));
opt->abbrev = 0;
opt->diff = 1;
opt->disable_stdin = 1;