Skip to content

Commit 6887a08

Browse files
Passes upstream name for push and recognizes default worktree
1 parent da75c3b commit 6887a08

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

src/webviews/apps/plus/home/components/merge-target-status.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { css, html, LitElement, nothing } from 'lit';
22
import { customElement, property, state } from 'lit/decorators.js';
3-
import { merge } from '../../../../../git/actions/repository';
43
import { createCommandLink } from '../../../../../system/commands';
54
import { pluralize } from '../../../../../system/string';
65
import type { BranchAndTargetRefs, BranchRef, GetOverviewBranch } from '../../../../home/protocol';
@@ -292,6 +291,7 @@ export class GlMergeTargetStatus extends LitElement {
292291
repoPath: this.branch.repoPath,
293292
branchId: this.mergedStatus.localBranchOnly.id!,
294293
branchName: this.mergedStatus.localBranchOnly.name,
294+
branchUpstreamName: this.mergedStatus.localBranchOnly.upstream?.name,
295295
};
296296
return html`<div class="header">
297297
<span class="header__title"
@@ -323,7 +323,10 @@ export class GlMergeTargetStatus extends LitElement {
323323
this.branchRef,
324324
mergeTargetRef,
325325
])}"
326-
>Delete ${this.branch.worktree ? 'Worktree' : 'Branch'}
326+
>Delete
327+
${this.branch.worktree != null && !this.branch.worktree.isDefault
328+
? 'Worktree'
329+
: 'Branch'}
327330
${renderBranchName(this.branch.name, this.branch.worktree != null)}</gl-button
328331
>
329332
</div>
@@ -348,7 +351,8 @@ export class GlMergeTargetStatus extends LitElement {
348351
<gl-button
349352
full
350353
href="${createCommandLink('gitlens.home.deleteBranchOrWorktree', this.branchRef)}"
351-
>Delete ${this.branch.worktree ? 'Worktree' : 'Branch'}
354+
>Delete
355+
${this.branch.worktree != null && !this.branch.worktree.isDefault ? 'Worktree' : 'Branch'}
352356
${renderBranchName(this.branch.name, this.branch.worktree != null)}</gl-button
353357
>
354358
</div>

src/webviews/home/homeWebview.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,12 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
11931193
refType: 'branch',
11941194
remote: false,
11951195
repoPath: ref.repoPath,
1196+
upstream: ref.branchUpstreamName
1197+
? {
1198+
name: ref.branchUpstreamName,
1199+
missing: false,
1200+
}
1201+
: undefined,
11961202
},
11971203
});
11981204
}
@@ -1432,7 +1438,7 @@ function getOverviewBranchesCore(
14321438
state: branch.state,
14331439
status: branch.status,
14341440
upstream: branch.upstream,
1435-
worktree: wt ? { name: wt.name, uri: wt.uri.toString() } : undefined,
1441+
worktree: wt ? { name: wt.name, uri: wt.uri.toString(), isDefault: wt.isDefault } : undefined,
14361442
});
14371443
}
14381444

src/webviews/home/protocol.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ export interface GetOverviewBranch {
182182
worktree?: {
183183
name: string;
184184
uri: string;
185+
isDefault: boolean;
185186
};
186187
}
187188

@@ -321,6 +322,7 @@ export interface BranchRef {
321322
repoPath: string;
322323
branchId: string;
323324
branchName: string;
325+
branchUpstreamName?: string;
324326
}
325327

326328
export interface BranchAndTargetRefs extends BranchRef {

0 commit comments

Comments
 (0)