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

Method addFiles

src/main/java/club/qqtim/command/Add.java:46–59  ·  view source on GitHub ↗

update the index file content: if new file then add while old file will be updated content is a big easy (key val directly) json like this: { ".\\doc\\OptionsAndParameters2.png": "f4a36c21ce890b0fa10067c10dab416e9b71a13e" }

(List<String> files)

Source from the content-addressed store, hash-verified

44 * }
45 */
46 private void addFiles(List<String> files) {
47 final String indexContent = FileUtil.getFileAsString(ConstantVal.INDEX, ConstantVal.NONE);
48 final JsonObject asJsonObject = new Gson().fromJson(indexContent, JsonObject.class);
49
50 files.forEach(file -> {
51 final boolean isFile = FileUtil.isFile(file);
52 if (isFile) {
53 addFile(asJsonObject, file);
54 } else { // is directory
55 addDirectory(asJsonObject, file);
56 }
57 });
58 FileUtil.createFile(asJsonObject.toString(), ConstantVal.INDEX);
59 }
60
61 private void addFile(JsonObject asJsonObject, String file) {
62 HashObject hashObject = new HashObject();

Callers 1

runMethod · 0.95

Calls 6

getFileAsStringMethod · 0.95
isFileMethod · 0.95
addFileMethod · 0.95
addDirectoryMethod · 0.95
createFileMethod · 0.95
toStringMethod · 0.45

Tested by

no test coverage detected