| | |
| | | import com.gitblit.models.PathModel.PathChangeModel;
|
| | | import com.gitblit.models.RefModel;
|
| | |
|
| | | /**
|
| | | * Collection of static methods for retrieving information from a repository.
|
| | | * |
| | | * @author James Moger
|
| | | * |
| | | */
|
| | | public class JGitUtils {
|
| | |
|
| | | static final Logger LOGGER = LoggerFactory.getLogger(JGitUtils.class);
|
| | |
| | |
|
| | | /**
|
| | | * Determine if a repository has any commits. This is determined by checking
|
| | | * the objects/info and objects/pack folders.
|
| | | * the for loose and packed objects.
|
| | | *
|
| | | * @param repository
|
| | | * @return true if the repository has commits
|
| | | */
|
| | | public static boolean hasCommits(Repository repository) {
|
| | | if (repository != null && repository.getDirectory().exists()) {
|
| | | return (new File(repository.getDirectory(), "objects/info").list().length > 0)
|
| | | if (repository != null && repository.getDirectory().exists()) { |
| | | return (new File(repository.getDirectory(), "objects").list().length > 2)
|
| | | || (new File(repository.getDirectory(), "objects/pack").list().length > 0);
|
| | | }
|
| | | return false;
|
| | |
| | | return list;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Enumeration of the search types.
|
| | | */
|
| | | public static enum SearchType {
|
| | | AUTHOR, COMMITTER, COMMIT;
|
| | |
|