Java Code Examples for org.eclipse.jgit.lib.FileMode#getObjectType()

The following examples show how to use org.eclipse.jgit.lib.FileMode#getObjectType() . 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: GitIgnore.java    From git-as-svn with GNU General Public License v2.0 6 votes vote down vote up
@Nullable
@Override
public GitProperty createForChild(@NotNull String name, @NotNull FileMode fileMode) {
  if (matchers.isEmpty() || (fileMode.getObjectType() == Constants.OBJ_BLOB)) {
    return null;
  }
  final List<String> localList = new ArrayList<>();
  final List<String> globalList = new ArrayList<>();
  final List<PathMatcher> childMatchers = new ArrayList<>();
  for (PathMatcher matcher : matchers) {
    processMatcher(localList, globalList, childMatchers, matcher.createChild(name, true));
  }
  if (localList.isEmpty() && globalList.isEmpty() && childMatchers.isEmpty()) {
    return null;
  }
  return new GitIgnore(localList, globalList, childMatchers);
}
 
Example 2
Source File: GitFileTreeEntry.java    From git-as-svn with GNU General Public License v2.0 5 votes vote down vote up
@NotNull
@Override
public Map<String, String> getProperties() throws IOException {
  final Map<String, String> props = getUpstreamProperties();
  final FileMode fileMode = getFileMode();
  if (fileMode.equals(FileMode.SYMLINK)) {
    props.remove(SVNProperty.EOL_STYLE);
    props.remove(SVNProperty.MIME_TYPE);
    props.put(SVNProperty.SPECIAL, "*");
  } else {
    if (fileMode.equals(FileMode.EXECUTABLE_FILE))
      props.put(SVNProperty.EXECUTABLE, "*");

    if (props.containsKey(SVNProperty.MIME_TYPE)) {
      props.remove(SVNProperty.EOL_STYLE);
    } else if (props.containsKey(SVNProperty.EOL_STYLE)) {
      props.remove(SVNProperty.MIME_TYPE);
    } else if (fileMode.getObjectType() == Constants.OBJ_BLOB) {
      if (branch.getRepository().isObjectBinary(filter, getObjectId())) {
        props.put(SVNProperty.MIME_TYPE, MIME_BINARY);
      } else {
        props.put(SVNProperty.EOL_STYLE, SVNProperty.EOL_STYLE_NATIVE);
      }
    }
  }
  return props;
}
 
Example 3
Source File: GitFilterProperty.java    From git-as-svn with GNU General Public License v2.0 5 votes vote down vote up
@Nullable
@Override
public GitProperty createForChild(@NotNull String name, @NotNull FileMode fileMode) {
  final boolean isDir = fileMode.getObjectType() != Constants.OBJ_BLOB;
  final PathMatcher matcherChild = matcher.createChild(name, isDir);
  if ((matcherChild != null) && (isDir || matcherChild.isMatch())) {
    return new GitFilterProperty(matcherChild, filterName);
  }
  return null;
}
 
Example 4
Source File: GitAutoProperty.java    From git-as-svn with GNU General Public License v2.0 5 votes vote down vote up
@Nullable
@Override
public GitProperty createForChild(@NotNull String name, @NotNull FileMode fileMode) {
  if (fileMode.getObjectType() == Constants.OBJ_BLOB) {
    return null;
  }
  if (matcher.getSvnMaskGlobal() != null) {
    return null;
  }
  final PathMatcher matcherChild = matcher.createChild(name, true);
  if (matcherChild == null) {
    return null;
  }
  return new GitAutoProperty(matcherChild, property, value);
}