@NotNull
  public static String findCommonIndent(@NotNull Iterable<String> lines, boolean ignoreFirstLine) {
    String minIndent = null;
    boolean allLinesEmpty = true;
    if (Iterables.isEmpty(lines)) {
      return "";
    }
    boolean hasBadEmptyLineIndent = false;
    for (String line : Iterables.skip(lines, ignoreFirstLine ? 1 : 0)) {
      final boolean lineEmpty = StringUtil.isEmptyOrSpaces(line);
      if (lineEmpty && !allLinesEmpty) {
        continue;
      }
      final String indent = getLineIndent(line);
      if (minIndent == null || (!lineEmpty && allLinesEmpty) || minIndent.startsWith(indent)) {
        minIndent = indent;
      }
      else if (!indent.startsWith(minIndent)) {
        if (lineEmpty) {
          hasBadEmptyLineIndent = true;
        }
        else {
          return "";
        }
      }
      allLinesEmpty &= lineEmpty;
    }
    if (allLinesEmpty && hasBadEmptyLineIndent) {
      return "";
    }
    return StringUtil.notNullize(minIndent);
  }
@NotNull
  public static String findCommonIndent(@NotNull Iterable<String> lines, boolean ignoreFirstLine)