MCPcopy Create free account
hub / github.com/ReZeroS/git / getWorkingTree

Method getWorkingTree

src/main/java/club/qqtim/command/Diff.java:74–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

72 }
73
74 public static Map<String, String> getWorkingTree() {
75 final Path basePath = Paths.get(ConstantVal.BASE_PATH);
76 try {
77 return FileUtil.walk(basePath, Integer.MAX_VALUE)
78 .filter(Files::isRegularFile)
79 .map(path -> basePath.relativize(path).toString())
80 .filter(ZitContext::isNotIgnored)
81 .collect(Collectors.toMap(key -> basePath.resolve(key).toString(), path -> {
82 final File file = new File(basePath.resolve(path).toString());
83 final byte[] fileContent = FileUtil.getFileAsBytes(file);
84 return HashObject.hashObject(fileContent, ConstantVal.BLOB);
85 }));
86 } catch (IOException e) {
87 log.error(e.toString());
88 }
89 return Collections.emptyMap();
90 }
91
92
93}

Callers 2

callMethod · 0.95
runMethod · 0.95

Calls 5

walkMethod · 0.95
getFileAsBytesMethod · 0.95
hashObjectMethod · 0.95
errorMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected