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

Method call

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

Source from the content-addressed store, hash-verified

44
45
46 @Override
47 public String call() {
48 String objectId;
49 Map<String, String> treeFrom = new HashMap<>(16), treeTo;
50 if (this.commit != null) {
51 objectId = ZitContext.getId(this.commit);
52 treeFrom = ReadTree.getTree(Commit.getCommit(objectId).getTree());
53 }
54 final String indexContent = FileUtil.getFileAsString(ConstantVal.INDEX, ConstantVal.NONE);
55
56 if (cached) {
57 treeTo = new Gson().fromJson(indexContent, new TypeToken<Map<String, String>>(){}.getType());
58 if (this.commit == null) {
59 objectId = ZitContext.getId(ConstantVal.HEAD_ALIAS);
60 treeFrom = ReadTree.getTree(Commit.getCommit(objectId).getTree());
61 }
62 } else {
63 treeTo = Diff.getWorkingTree();
64 if (this.commit == null) {
65 treeFrom = new Gson().fromJson(indexContent, new TypeToken<Map<String, String>>(){}.getType());
66 }
67 }
68
69 final String diffChanges = DiffUtil.diffTrees(treeFrom, treeTo);
70 log.info(diffChanges);
71 return diffChanges;
72 }
73
74 public static Map<String, String> getWorkingTree() {
75 final Path basePath = Paths.get(ConstantVal.BASE_PATH);

Callers

nothing calls this directly

Calls 6

getIdMethod · 0.95
getTreeMethod · 0.95
getCommitMethod · 0.95
getFileAsStringMethod · 0.95
getWorkingTreeMethod · 0.95
diffTreesMethod · 0.95

Tested by

no test coverage detected