private void traverse(File dir, String relativePath) throws IOException {
            if (mIgnoreDirectories.contains(relativePath)) {
                // DCI: ok for .git .hg, won't work for .svn sprinkled in every subdir...
                return;
            }
            String[] values = dir.list();
            if (values.length == 0) {
                addEmptyDirectory(relativePath);
            }

            for (String value : values) {
                File file = new File(dir, value);
                if (file.isFile()) {
                    LinkDigest digest = LinkDigest.NULL_DIGEST;
                    if (mCalculateDigests) {
                        digest = IOUtil.getFileDigest(new FileInputStream(file));
                    }
                    addFile(join(relativePath, value), digest);

                }
                if (file.isDirectory()) {
                    traverse(file, join(relativePath, value));
                }
            }
        }