# fix: support shared-store session adoption

`53264b9`·

peyton-alt·3w ago·4 files·+198 added/-30 removed

## Sessions

48521e055655View transcript

[?\
--enable hooks and amake sure entire is enabled in this session and you're up to date on latest version and main pleaseCodex·GPT-5.5·3 steps](/content/gh/entireio/cli/session/019ed5fe-ec49-7a72-89fd-f38e323f5448#timeline-48521e055655/index.html)

## Changes

4

- cmd/entire/cli

- checkpoint

- Mopen.go-2

- Msession_adopt.go+66/-5

- Msession_adopt_test.go+132/-19

- strategy

- Mmanual_commit.go-4

```go
54 unmodified lines

}

// Temporary returns the git-backed temporary shadow-branch store.
//
//nolint:ireturn // temporary store capability is the abstraction boundary
func (s *Stores) Temporary() TemporaryStore { return s.temporary }

// Refs returns the resolved committed-ref topology.
```

Mcmd/entire/cli/checkpoint/open.go-2

```
67 unmodified lines

}

// 13 unmodified lines
//
func sessionBelongsToSourceWorktree(state *session.State, sourceWorktree, sourceWorktreeID string) bool {
  if state == nil {
    return false
  }
  if state.WorktreeID != "" && sourceWorktreeID != "" {
    return state.WorktreeID == sourceWorktreeID
  }
  if state.WorktreePath != "" {
    return sameAdoptPath(state.WorktreePath, sourceWorktree)
  }
  return true
}

// 13 unmodified lines
```

### Example function
```go
func adoptSessionWorktreeLabel(state *session.State) string {
    if state == nil {
        return unknownPlaceholder
    }
    if state.WorktreePath != "" {
        return state.WorktreePath
    }
    if state.WorktreeID != "" {
        return state.WorktreeID
    }
    return unknownPlaceholder
}
```

## Test case
```go
func TestSessionAdopt_FiltersSharedSourceStoreByFromWorktree(t *testing.T) {
    // Your test code here
}

func TestStateStoreForWorktreeIgnoresGitStderrOnSuccess(t *testing.T) {
    // Your test code here
}

func TestSessionAdopt_RejectsSameGitCommonDir(t *testing.T) {
    // Your test code here
}

func TestSessionAdopt_MovesSameStoreSessionIntoCurrentWorktree(t *testing.T) {
    // Your test code here
}
```
