Java Code Examples for org.eclipse.jgit.lib.FileMode#TYPE_TREE
The following examples show how to use
org.eclipse.jgit.lib.FileMode#TYPE_TREE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResolveMerger.java From onedev with MIT License | 5 votes |
private boolean isWorktreeDirty(WorkingTreeIterator work, DirCacheEntry ourDce) throws IOException { if (work == null) return false; final int modeF = tw.getRawMode(T_FILE); final int modeO = tw.getRawMode(T_OURS); // Worktree entry has to match ours to be considered clean boolean isDirty; if (ourDce != null) isDirty = work.isModified(ourDce, true, reader); else { isDirty = work.isModeDifferent(modeO); if (!isDirty && nonTree(modeF)) isDirty = !tw.idEqual(T_FILE, T_OURS); } // Ignore existing empty directories if (isDirty && modeF == FileMode.TYPE_TREE && modeO == FileMode.TYPE_MISSING) isDirty = false; if (isDirty) failingPaths.put(tw.getPathString(), MergeFailureReason.DIRTY_WORKTREE); return isDirty; }
Example 2
Source File: BlobIdent.java From onedev with MIT License | 4 votes |
public boolean isTree() { return (FileMode.TYPE_MASK & mode) == FileMode.TYPE_TREE; }
Example 3
Source File: Status.java From orion.server with Eclipse Public License 1.0 | 4 votes |
private JSONArray toJSONArray(Set<String> set, IPath basePath, URI baseLocation, String diffType) throws JSONException, URISyntaxException { JSONArray result = new JSONArray(); DirCache cache = null; try{ cache = db.readDirCache(); }catch(Exception ex){ } for (String s : set) { JSONObject object = new JSONObject(); boolean isSubmodule = false, isDirectory = false; if(cache!=null){ DirCacheEntry entry = cache.getEntry(s); int fileMode=-1; if(entry!=null){ fileMode = entry.getRawMode(); } //isSubmodule = this.submoduleStatuses.keySet().contains(s); isSubmodule = fileMode!=-1 && fileMode== FileMode.TYPE_GITLINK; isDirectory = fileMode!= -1 && (fileMode & FileMode.TYPE_TREE) != 0; } object.put(ProtocolConstants.KEY_NAME, s); IPath relative = new Path(s).makeRelativeTo(basePath); object.put(ProtocolConstants.KEY_PATH, relative); URI fileLocation = statusToFileLocation(baseLocation); object.put(ProtocolConstants.KEY_LOCATION, URIUtil.append(fileLocation, relative.toString())); if(isDirectory){ object.put(ProtocolConstants.KEY_DIRECTORY, true); } if(isSubmodule){ object.put(GitConstants.KEY_IS_SUBMODULE, true); } JSONObject gitSection = new JSONObject(); URI diffLocation = statusToDiffLocation(baseLocation, diffType); gitSection.put(GitConstants.KEY_DIFF, URIUtil.append(diffLocation, relative.toString())); object.put(GitConstants.KEY_GIT, gitSection); URI commitLocation = statusToCommitLocation(baseLocation, Constants.HEAD); gitSection.put(GitConstants.KEY_COMMIT, URIUtil.append(commitLocation, relative.toString())); object.put(GitConstants.KEY_GIT, gitSection); URI indexLocation = statusToIndexLocation(baseLocation); gitSection.put(GitConstants.KEY_INDEX, URIUtil.append(indexLocation, relative.toString())); object.put(GitConstants.KEY_GIT, gitSection); result.put(object); } return result; }