Skip to content

Commit 366c211

Browse files
felladrinroboquat
authored andcommitted
Properly handle the workspace list when the workspace context ref is undefined
1 parent dc5c59e commit 366c211

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

components/gitpod-protocol/java/src/main/java/io/gitpod/gitpodprotocol/api/entities/WorkspaceContext.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
package io.gitpod.gitpodprotocol.api.entities;
66

7+
import java.util.Optional;
8+
79
public class WorkspaceContext {
810
private String normalizedContextURL;
911
private String ref;
@@ -16,8 +18,8 @@ public void setNormalizedContextURL(String normalizedContextURL) {
1618
this.normalizedContextURL = normalizedContextURL;
1719
}
1820

19-
public String getRef() {
20-
return ref;
21+
public Optional<String> getRef() {
22+
return Optional.ofNullable(ref);
2123
}
2224

2325
public void setRef(String ref) {

components/gitpod-protocol/src/protocol.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,7 @@ export namespace ExternalImageConfigFile {
878878

879879
export interface WorkspaceContext {
880880
title: string;
881+
ref?: string;
881882
/** This contains the URL portion of the contextURL (which might contain other modifiers as well). It's optional because it's not set for older workspaces. */
882883
normalizedContextURL?: string;
883884
forceCreateNewWorkspace?: boolean;

components/ide/jetbrains/gateway-plugin/src/main/kotlin/io/gitpod/jetbrains/gateway/GitpodWorkspacesView.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,11 @@ class GitpodWorkspacesView(
283283
it.totalUncommitedFiles + it.totalUntrackedFiles + it.totalUnpushedCommits
284284
} ?: 0
285285
row {
286-
label(info.workspace.context.ref)
286+
if (info.workspace.context.ref.isPresent()) {
287+
label(info.workspace.context.ref.get())
288+
} else {
289+
label("(detached)")
290+
}
287291
}.rowComment(
288292
when {
289293
changes == 1 -> "<b>$changes Change</b>"

0 commit comments

Comments
 (0)