()
| 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); |
nothing calls this directly
no test coverage detected