Skip to content

Commit

Permalink
fix commit retrieval loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Enquier committed Apr 17, 2024
1 parent 7de6dd0 commit 2c51e17
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.openmbee.mms.data.dao.BranchDAO;
import org.openmbee.mms.data.dao.CommitDAO;
import org.openmbee.mms.core.exceptions.InternalErrorException;
import org.openmbee.mms.core.config.Constants;
import org.openmbee.mms.data.domains.scoped.Branch;
import org.openmbee.mms.data.domains.scoped.Commit;
import org.openmbee.mms.rdb.repositories.BaseDAOImpl;
Expand Down Expand Up @@ -63,7 +64,7 @@ public Optional<Commit> findById(long id) {
String sql = "SELECT * FROM commits WHERE id = ?";

List<Commit> l = getConn()
.query(sql, new Object[]{id}, new CommitRowMapper());
.query(sql, new CommitRowMapper(), new Object[]{id});
return l.isEmpty() ? Optional.empty() : Optional.of(l.get(0));

}
Expand All @@ -72,7 +73,7 @@ public Optional<Commit> findByCommitId(String commitId) {
String sql = "SELECT * FROM commits WHERE commitid = ?";

List<Commit> l = getConn()
.query(sql, new Object[]{commitId}, new CommitRowMapper());
.query(sql, new CommitRowMapper(), new Object[]{commitId});
return l.isEmpty() ? Optional.empty() : Optional.of(l.get(0));

}
Expand Down Expand Up @@ -156,7 +157,7 @@ public List<Commit> findByRefAndTimestampAndLimit(Branch ref, Instant timestamp,
currentRef = ref.getParentRefId();
currentCid = ref.getParentCommit();

if (currentRef == null) {
if (currentRef == null || currentRef == Constants.MASTER_BRANCH) {
break;
}
Optional<Branch> parent = branchRepository.findByBranchId(currentRef);
Expand Down

0 comments on commit 2c51e17

Please sign in to comment.