diff*: fix worktree setup
This fixes "git diff", "git diff-files" and "git diff-index" to work correctly under worktree setup. Because diff* family works in many modes and not all of them require worktree, Junio made a nice summary (with a little modification from me): * diff-files is about comparing with work tree, so it obviously needs a work tree; * diff-index also does, except "diff-index --cached" or "diff --cached TREE" * no-index is about random files outside git context, so it obviously doesn't need any work tree; * comparing two (or more) trees doesn't; * comparing two blobs doesn't; * comparing a blob with a random file doesn't; Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
c67b1fa349
commit
4f38f6b5ba
2
git.c
2
git.c
@ -286,7 +286,7 @@ static void handle_internal_command(int argc, const char **argv)
|
||||
{ "count-objects", cmd_count_objects, RUN_SETUP },
|
||||
{ "describe", cmd_describe, RUN_SETUP },
|
||||
{ "diff", cmd_diff },
|
||||
{ "diff-files", cmd_diff_files, RUN_SETUP },
|
||||
{ "diff-files", cmd_diff_files, RUN_SETUP | NEED_WORK_TREE },
|
||||
{ "diff-index", cmd_diff_index, RUN_SETUP },
|
||||
{ "diff-tree", cmd_diff_tree, RUN_SETUP },
|
||||
{ "fast-export", cmd_fast_export, RUN_SETUP },
|
||||
|
Reference in New Issue
Block a user