Skip to content

Commit

Permalink
Merge pull request #267 from Open-MBEE/fix/branchFromCommitStatus
Browse files Browse the repository at this point in the history
set appropriate status if branching from commit
  • Loading branch information
dlamoris authored Mar 4, 2024
2 parents f4b04bf + 255ffd0 commit 7168b97
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,8 @@ public RefJson createBranch(String projectId, RefJson branch) {
branch.setCreated(Formats.FORMATTER.format(now));
branch.setDeleted(false);
branch.setProjectId(projectId);
branch.setStatus("created");
boolean fromCommit = branch.getParentCommitId() == null ? false : true;

branch.setStatus(fromCommit ? "creating" : "created");
if (branch.getDocId() == null || branch.getDocId().isEmpty()) {
String docId = branchIndex.createDocId(branch);
branch.setDocId(docId);
Expand Down Expand Up @@ -222,7 +221,6 @@ public RefJson createBranchfromCommit(String projectId, RefJson parentCommitIdRe
ContextHolder.setContext(projectId, parentRef);

RefJson branchFromCommit = this.createBranch(projectId, parentCommitIdRef);

ContextHolder.setContext(projectId, branchFromCommit.getId());

// Get current nodes from database
Expand All @@ -249,7 +247,8 @@ public RefJson createBranchfromCommit(String projectId, RefJson parentCommitIdRe
}
}
nodeRepository.updateAll(nodes);

branchFromCommit.setStatus("created");
branchIndex.update(branchFromCommit);
try { nodeIndex.addToRef(docIds); } catch(Exception e) {}

return branchFromCommit;
Expand Down

0 comments on commit 7168b97

Please sign in to comment.