You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4f33eaa
Browse filesBrowse the repository at this point in the historyBrowse files
Add basic support for worktree branches (issue gitx#629)
A branch checked out somewhere else cannot be checked out here.
GitX showed such a branch like any other, in the sidebar and in the
commit list alike, and went on to offer actions that git refuses or,
worse, that `update-ref -d` carries out and leaves the other worktree
pointing at a branch that is gone.
* Read `git worktree list --porcelain` and answer which worktree holds a
given ref, our own excluded, re-read whenever the refs are reloaded
* Give those branches their own sidebar icon and a teal commit list
label, and name the worktree holding them in the row's tooltip
* Offer that worktree in place of Checkout, and grey out Remove with a
tooltip saying which worktree holds it, both settled while the menu is
built
* Refuse the removal in the repository itself, so a caller that never
asked cannot walk into it either
NSString *checkoutTitle = [NSStringstringWithFormat:NSLocalizedString(@"Checkout “%@”", @"Contextual Menu Item to check out the selected ref"), refName];
NSString *openWorktreeTitle = [NSStringstringWithFormat:NSLocalizedString(@"Open Worktree “%@”", @"Contextual Menu Item to open the worktree holding the selected branch"), worktreePath.lastPathComponent];
NSString *checkoutTitle = [NSStringstringWithFormat:NSLocalizedString(@"Checkout “%@”", @"Contextual Menu Item to check out the selected ref"), refName];
deleteItem.toolTip = worktreePath ? [NSStringstringWithFormat:NSLocalizedString(@"Checked out in the worktree at %@", @"Contextual Menu Item tooltip for a branch that cannot be removed because a worktree holds it"), worktreePath] : nil;
self.toolTip = _worktreePath.length ? [NSStringstringWithFormat:NSLocalizedString(@"Checked out in the worktree at %@", @"Sidebar tooltip for a branch held by another worktree"), _worktreePath] : nil;
0 commit comments