From: Mike Hommey Date: Sat, 3 Nov 2007 11:23:12 +0000 (+0100) Subject: Use setup_work_tree() in builtin-ls-files.c X-Git-Tag: v1.5.4-rc0~254^2~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7d8ae93292e2cd862359f02879a0c954faf8afa8;p=git.git Use setup_work_tree() in builtin-ls-files.c Signed-off-by: Mike Hommey Acked-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- diff --git a/builtin-ls-files.c b/builtin-ls-files.c index b70da1863..e0b856f43 100644 --- a/builtin-ls-files.c +++ b/builtin-ls-files.c @@ -525,11 +525,8 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix) break; } - if (require_work_tree && !is_inside_work_tree()) { - const char *work_tree = get_git_work_tree(); - if (!work_tree || chdir(work_tree)) - die("This operation must be run in a work tree"); - } + if (require_work_tree && !is_inside_work_tree()) + setup_work_tree(); pathspec = get_pathspec(prefix, argv + i);