-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: added status changes #38170
chore: added status changes #38170
Changes from 8 commits
9e090e7
7d556ed
21933b8
4cd584f
a7b8606
9f2f3bc
592833e
f5dcc3f
73a48ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,4 @@ | |
<option name="Make" enabled="true" /> | ||
</method> | ||
</configuration> | ||
</component> | ||
</component> |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2,6 +2,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import com.appsmith.external.constants.AnalyticsEvents; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import com.appsmith.external.dtos.GitBranchDTO; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import com.appsmith.external.dtos.GitStatusDTO; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import com.appsmith.external.git.constants.GitConstants; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import com.appsmith.external.git.constants.GitSpan; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import com.appsmith.external.git.handler.FSGitHandler; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -617,4 +618,19 @@ public Mono<? extends ArtifactExchangeJson> recreateArtifactJsonFromLastCommit( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
workspaceId, baseArtifactId, repoName, refName, artifactType); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
@Override | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
public Mono<GitStatusDTO> getStatus(ArtifactJsonTransformationDTO jsonTransformationDTO) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
String workspaceId = jsonTransformationDTO.getWorkspaceId(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
String baseArtifactId = jsonTransformationDTO.getBaseArtifactId(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
String repoName = jsonTransformationDTO.getRepoName(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
String refName = jsonTransformationDTO.getRefName(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ArtifactType artifactType = jsonTransformationDTO.getArtifactType(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GitArtifactHelper<?> gitArtifactHelper = gitArtifactHelperResolver.getArtifactHelper(artifactType); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Path repoSuffix = gitArtifactHelper.getRepoSuffixPath(workspaceId, baseArtifactId, repoName); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Path repoPath = fsGitHandler.createRepoPath(repoSuffix); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return fsGitHandler.getStatus(repoPath, refName); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+622
to
+635
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add error handling for Git status operations While the implementation is clean, it should include error handling for potential Git operation failures, similar to other methods in the class. Consider wrapping the Git status operation with error handling: @Override
public Mono<GitStatusDTO> getStatus(ArtifactJsonTransformationDTO jsonTransformationDTO) {
String workspaceId = jsonTransformationDTO.getWorkspaceId();
String baseArtifactId = jsonTransformationDTO.getBaseArtifactId();
String repoName = jsonTransformationDTO.getRepoName();
String refName = jsonTransformationDTO.getRefName();
ArtifactType artifactType = jsonTransformationDTO.getArtifactType();
GitArtifactHelper<?> gitArtifactHelper = gitArtifactHelperResolver.getArtifactHelper(artifactType);
Path repoSuffix = gitArtifactHelper.getRepoSuffixPath(workspaceId, baseArtifactId, repoName);
Path repoPath = fsGitHandler.createRepoPath(repoSuffix);
- return fsGitHandler.getStatus(repoPath, refName);
+ return fsGitHandler.getStatus(repoPath, refName)
+ .onErrorResume(error -> {
+ log.error("Error while fetching git status: {}", error.getMessage());
+ return Mono.error(new AppsmithException(
+ AppsmithError.GIT_ACTION_FAILED,
+ "status",
+ error.getMessage()));
+ });
} 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure
branchedGitMetadata
is not null before usageThere is a potential
NullPointerException
ifbranchedGitMetadata
is null. Add a null check before settinggitAuth
.Suggested fix: