diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/git/central/CentralGitServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/central/CentralGitServiceCEImpl.java index 436564b5fc2a..fa56bff62c99 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/git/central/CentralGitServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/central/CentralGitServiceCEImpl.java @@ -1988,30 +1988,29 @@ private Mono pullAndRehydrateArtifact( importedBranchedArtifact .getGitArtifactMetadata() .getIsRepoPrivate())) - .flatMap(importedArtifact -> - gitArtifactHelper.getArtifactById(importedArtifact.getId(), null)) .flatMap(importedBranchedArtifact -> { - return gitArtifactHelper - .publishArtifact(importedBranchedArtifact, false) - .then(getGitUserForArtifactId(baseArtifactId)) - .flatMap(gitAuthor -> { - CommitDTO commitDTO = new CommitDTO(); - commitDTO.setMessage(DEFAULT_COMMIT_MESSAGE - + GitDefaultCommitMessage.SYNC_WITH_REMOTE_AFTER_PULL.getReason()); - commitDTO.setAuthor(gitAuthor); - - GitPullDTO gitPullDTO = new GitPullDTO(); - gitPullDTO.setMergeStatus(status); - gitPullDTO.setArtifact(importedBranchedArtifact); - - return Mono.defer(() -> commitArtifact( - commitDTO, - baseArtifact, - importedBranchedArtifact, - gitType, - false)) - .thenReturn(gitPullDTO); - }); + return gitArtifactHelper.publishArtifact(importedBranchedArtifact, false); + }) + .flatMap(publishedArtifact -> { + return getGitUserForArtifactId(baseArtifactId).flatMap(gitAuthor -> { + CommitDTO commitDTO = new CommitDTO(); + commitDTO.setMessage(DEFAULT_COMMIT_MESSAGE + + GitDefaultCommitMessage.SYNC_WITH_REMOTE_AFTER_PULL.getReason()); + commitDTO.setAuthor(gitAuthor); + + GitPullDTO gitPullDTO = new GitPullDTO(); + gitPullDTO.setMergeStatus(status); + gitPullDTO.setArtifact(publishedArtifact); + + // TODO: this can be done async as well. + return Mono.defer(() -> commitArtifact( + commitDTO, + publishedArtifact.getId(), + publishedArtifact.getArtifactType(), + gitType, + false)) + .thenReturn(gitPullDTO); + }); }); }); }