Skip to content

Commit c92c635

Browse files
Passes upstream name for push and recognizes default worktree
1 parent fa66b01 commit c92c635

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
@@ -1215,6 +1215,12 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
12151215
refType: 'branch',
12161216
remote: false,
12171217
repoPath: ref.repoPath,
1218+
upstream: ref.branchUpstreamName
1219+
? {
1220+
name: ref.branchUpstreamName,
1221+
missing: false,
1222+
}
1223+
: undefined,
12181224
},
12191225
});
12201226
}
@@ -1454,7 +1460,7 @@ function getOverviewBranchesCore(
14541460
state: branch.state,
14551461
status: branch.status,
14561462
upstream: branch.upstream,
1457-
worktree: wt ? { name: wt.name, uri: wt.uri.toString() } : undefined,
1463+
worktree: wt ? { name: wt.name, uri: wt.uri.toString(), isDefault: wt.isDefault } : undefined,
14581464
});
14591465
}
14601466

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)