ls-files: factor out debug info into a function