Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion datajunction-ui/src/app/components/NamespaceHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,13 @@ export default function NamespaceHeader({
(() => {
const repoBranch =
gitConfig?.git_branch || gitConfig?.default_branch;
const editableBranch = gitShape === 'branch' && !isGitManaged;
// Editable = the branch root (shape `branch`) OR a sub-namespace
// of a feature branch (resolves as `flat`, no parent_namespace of
// its own, so `gitShape` alone misses it — same trap as the
// read-only verdict). Without isFeatureBranch these sub-namespaces
// fall through to the not-git "Connect to Git" button.
const editableBranch =
!isGitManaged && (gitShape === 'branch' || isFeatureBranch);
const gitUrl = viewInGitUrl();

// Read-only: fork to propose a change; everything else in the menu.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,24 @@ describe('<NamespaceHeader />', () => {
});
},
);

// Regression: same `flat`-shape trap on the git action button. A feature
// branch sub-namespace is editable, so it must show the "Sync to Git"
// control — not the not-git "Connect to Git" button.
it('shows Sync to Git (not Connect to Git) for a feature branch sub-namespace', async () => {
renderReadOnlyVerdict({
namespace: 'test.feature.metrics',
configByNamespace: {
'test.feature.metrics': branchCfg('feature', 'test.feature.metrics'),
'test.feature': branchCfg('feature', 'test.feature'),
test: GIT_ROOT,
},
});
await waitFor(() =>
expect(screen.getByText('Sync to Git')).toBeInTheDocument(),
);
expect(screen.queryByText('Connect to Git')).not.toBeInTheDocument();
});
});

it('should open Create Branch modal when button is clicked', async () => {
Expand Down
Loading