count-objects: report unused files in $GIT_DIR/worktrees/...

In linked checkouts, borrowed parts like config is taken from
$GIT_COMMON_DIR. $GIT_DIR/config is never used. Report them as
garbage.

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:
Nguyễn Thái Ngọc Duy
2014-11-30 15:24:54 +07:00
committed by Junio C Hamano
parent e3df33bb1b
commit 77a6d84045
3 changed files with 31 additions and 3 deletions

View File

@ -70,8 +70,10 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
/* we do not take arguments other than flags for now */
if (argc)
usage_with_options(count_objects_usage, opts);
if (verbose)
if (verbose) {
report_garbage = real_report_garbage;
report_linked_checkout_garbage();
}
for_each_loose_file_in_objdir(get_object_directory(),
count_loose, count_cruft, NULL, NULL);