Skip to content

Commit 2701b82

Browse files
committed
fixed git pull scenario
1 parent 51902c8 commit 2701b82

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

app/server/appsmith-server/src/main/java/com/appsmith/server/git/central/CentralGitServiceCEImpl.java

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1988,30 +1988,29 @@ private Mono<GitPullDTO> pullAndRehydrateArtifact(
19881988
importedBranchedArtifact
19891989
.getGitArtifactMetadata()
19901990
.getIsRepoPrivate()))
1991-
.flatMap(importedArtifact ->
1992-
gitArtifactHelper.getArtifactById(importedArtifact.getId(), null))
19931991
.flatMap(importedBranchedArtifact -> {
1994-
return gitArtifactHelper
1995-
.publishArtifact(importedBranchedArtifact, false)
1996-
.then(getGitUserForArtifactId(baseArtifactId))
1997-
.flatMap(gitAuthor -> {
1998-
CommitDTO commitDTO = new CommitDTO();
1999-
commitDTO.setMessage(DEFAULT_COMMIT_MESSAGE
2000-
+ GitDefaultCommitMessage.SYNC_WITH_REMOTE_AFTER_PULL.getReason());
2001-
commitDTO.setAuthor(gitAuthor);
2002-
2003-
GitPullDTO gitPullDTO = new GitPullDTO();
2004-
gitPullDTO.setMergeStatus(status);
2005-
gitPullDTO.setArtifact(importedBranchedArtifact);
2006-
2007-
return Mono.defer(() -> commitArtifact(
2008-
commitDTO,
2009-
baseArtifact,
2010-
importedBranchedArtifact,
2011-
gitType,
2012-
false))
2013-
.thenReturn(gitPullDTO);
2014-
});
1992+
return gitArtifactHelper.publishArtifact(importedBranchedArtifact, false);
1993+
})
1994+
.flatMap(publishedArtifact -> {
1995+
return getGitUserForArtifactId(baseArtifactId).flatMap(gitAuthor -> {
1996+
CommitDTO commitDTO = new CommitDTO();
1997+
commitDTO.setMessage(DEFAULT_COMMIT_MESSAGE
1998+
+ GitDefaultCommitMessage.SYNC_WITH_REMOTE_AFTER_PULL.getReason());
1999+
commitDTO.setAuthor(gitAuthor);
2000+
2001+
GitPullDTO gitPullDTO = new GitPullDTO();
2002+
gitPullDTO.setMergeStatus(status);
2003+
gitPullDTO.setArtifact(publishedArtifact);
2004+
2005+
// TODO: this can be done async as well.
2006+
return Mono.defer(() -> commitArtifact(
2007+
commitDTO,
2008+
publishedArtifact.getId(),
2009+
publishedArtifact.getArtifactType(),
2010+
gitType,
2011+
false))
2012+
.thenReturn(gitPullDTO);
2013+
});
20152014
});
20162015
});
20172016
}

0 commit comments

Comments
 (0)