Skip to content

Commit 515316a

Browse files
committed
[ws-daemon] Properly handle git status for FWB workspaces
1 parent a2c08bc commit 515316a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

components/ws-daemon/pkg/internal/session/workspace.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,23 @@ func (s *Workspace) SetGitStatus(status *csapi.GitStatus) error {
248248

249249
// UpdateGitStatus attempts to update the LastGitStatus from the workspace's local working copy.
250250
func (s *Workspace) UpdateGitStatus(ctx context.Context) (res *csapi.GitStatus, err error) {
251-
loc := filepath.Join(s.Location, s.CheckoutLocation)
251+
loc := s.Location
252+
if loc == "" {
253+
// FWB workspaces don't have `Location` set, but rather ServiceLocDaemon and ServiceLocNode.
254+
// We'd can't easily produce the Git status, because in this context `mark` isn't mounted, and `upper`
255+
// only contains the full git working copy if the content was just initialised.
256+
// Something like
257+
// loc = filepath.Join(s.ServiceLocDaemon, "mark", "workspace")
258+
// does not work.
259+
//
260+
// TODO(cw): figure out a way to get ahold of the Git status.
261+
log.WithField("loc", loc).WithFields(s.OWI()).Debug("not updating Git status of FWB workspace")
262+
return
263+
}
264+
265+
loc = filepath.Join(loc, s.CheckoutLocation)
252266
if !git.IsWorkingCopy(loc) {
267+
log.WithField("loc", loc).WithFields(s.OWI()).Debug("did not find a Git working copy - not updating Git status")
253268
return nil, nil
254269
}
255270

0 commit comments

Comments
 (0)