Skip to content

Commit 8320554

Browse files
Passes upstream name for push and recognizes default worktree
1 parent 181ff40 commit 8320554

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
}
@@ -1431,7 +1437,7 @@ function getOverviewBranchesCore(
14311437
timestamp: timestamp,
14321438
status: branch.status,
14331439
upstream: branch.upstream,
1434-
worktree: wt ? { name: wt.name, uri: wt.uri.toString() } : undefined,
1440+
worktree: wt ? { name: wt.name, uri: wt.uri.toString(), isDefault: wt.isDefault } : undefined,
14351441
});
14361442
}
14371443

src/webviews/home/protocol.ts

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

@@ -320,6 +321,7 @@ export interface BranchRef {
320321
repoPath: string;
321322
branchId: string;
322323
branchName: string;
324+
branchUpstreamName?: string;
323325
}
324326

325327
export interface BranchAndTargetRefs extends BranchRef {

0 commit comments

Comments
 (0)