Skip to content

Commit ac18150

Browse files
committed
Adds stashes into Commit view
1 parent edbd4ce commit ac18150

File tree

13 files changed

+275
-66
lines changed

13 files changed

+275
-66
lines changed

package.json

Lines changed: 149 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,6 +1743,13 @@
17431743
"title": "Commits View",
17441744
"order": 110,
17451745
"properties": {
1746+
"gitlens.views.commits.showStashes": {
1747+
"type": "boolean",
1748+
"default": true,
1749+
"markdownDescription": "Specifies whether to show stashes in the _Commits_ view",
1750+
"scope": "window",
1751+
"order": 9
1752+
},
17461753
"gitlens.views.commits.showBranchComparison": {
17471754
"type": [
17481755
"boolean",
@@ -2192,6 +2199,13 @@
21922199
"scope": "window",
21932200
"order": 90
21942201
},
2202+
"gitlens.views.repositories.branches.showStashes": {
2203+
"type": "boolean",
2204+
"default": true,
2205+
"markdownDescription": "Specifies whether to show stashes in the _Commits_ and _Branches_ sections of the _Repositories_ view",
2206+
"scope": "window",
2207+
"order": 95
2208+
},
21952209
"gitlens.views.repositories.branches.showBranchComparison": {
21962210
"type": [
21972211
"boolean",
@@ -2355,6 +2369,13 @@
23552369
"title": "Branches View",
23562370
"order": 170,
23572371
"properties": {
2372+
"gitlens.views.branches.showStashes": {
2373+
"type": "boolean",
2374+
"default": true,
2375+
"markdownDescription": "Specifies whether to show stashes in the _Branches_ view",
2376+
"scope": "window",
2377+
"order": 9
2378+
},
23582379
"gitlens.views.branches.showBranchComparison": {
23592380
"type": [
23602381
"boolean",
@@ -2756,6 +2777,13 @@
27562777
"scope": "resource",
27572778
"order": 12
27582779
},
2780+
"gitlens.views.worktrees.showStashes": {
2781+
"type": "boolean",
2782+
"default": true,
2783+
"markdownDescription": "Specifies whether to show stashes in the _Worktrees_ view",
2784+
"scope": "window",
2785+
"order": 19
2786+
},
27592787
"gitlens.views.worktrees.showBranchComparison": {
27602788
"type": [
27612789
"boolean",
@@ -3337,6 +3365,13 @@
33373365
"scope": "window",
33383366
"order": 90
33393367
},
3368+
"gitlens.views.workspaces.branches.showStashes": {
3369+
"type": "boolean",
3370+
"default": true,
3371+
"markdownDescription": "Specifies whether to show stashes in the _Cloud Workspaces_ view",
3372+
"scope": "window",
3373+
"order": 9
3374+
},
33403375
"gitlens.views.workspaces.branches.showBranchComparison": {
33413376
"type": [
33423377
"boolean",
@@ -7673,6 +7708,14 @@
76737708
"command": "gitlens.views.branches.setShowBranchPullRequestOff",
76747709
"title": "Hide Branch Pull Requests"
76757710
},
7711+
{
7712+
"command": "gitlens.views.branches.setShowStashesOn",
7713+
"title": "Show Stashes"
7714+
},
7715+
{
7716+
"command": "gitlens.views.branches.setShowStashesOff",
7717+
"title": "Hide Stashes"
7718+
},
76767719
{
76777720
"command": "gitlens.views.commitDetails.refresh",
76787721
"title": "Refresh",
@@ -7759,6 +7802,14 @@
77597802
"command": "gitlens.views.commits.setShowBranchPullRequestOff",
77607803
"title": "Hide Current Branch Pull Request"
77617804
},
7805+
{
7806+
"command": "gitlens.views.commits.setShowStashesOn",
7807+
"title": "Show Stashes"
7808+
},
7809+
{
7810+
"command": "gitlens.views.commits.setShowStashesOff",
7811+
"title": "Hide Stashes"
7812+
},
77627813
{
77637814
"command": "gitlens.views.contributors.copy",
77647815
"title": "Copy"
@@ -8804,6 +8855,14 @@
88048855
"command": "gitlens.views.worktrees.setShowBranchPullRequestOff",
88058856
"title": "Hide Branch Pull Requests"
88068857
},
8858+
{
8859+
"command": "gitlens.views.worktrees.setShowStashesOn",
8860+
"title": "Show Stashes"
8861+
},
8862+
{
8863+
"command": "gitlens.views.worktrees.setShowStashesOff",
8864+
"title": "Hide Stashes"
8865+
},
88078866
{
88088867
"command": "gitlens.enableDebugLogging",
88098868
"title": "Enable Debug Logging",
@@ -11267,6 +11326,14 @@
1126711326
"command": "gitlens.views.branches.setShowBranchPullRequestOff",
1126811327
"when": "false"
1126911328
},
11329+
{
11330+
"command": "gitlens.views.branches.setShowStashesOn",
11331+
"when": "false"
11332+
},
11333+
{
11334+
"command": "gitlens.views.branches.setShowStashesOff",
11335+
"when": "false"
11336+
},
1127011337
{
1127111338
"command": "gitlens.views.commitDetails.refresh",
1127211339
"when": "false"
@@ -11343,6 +11410,14 @@
1134311410
"command": "gitlens.views.commits.setShowBranchPullRequestOff",
1134411411
"when": "false"
1134511412
},
11413+
{
11414+
"command": "gitlens.views.commits.setShowStashesOn",
11415+
"when": "false"
11416+
},
11417+
{
11418+
"command": "gitlens.views.commits.setShowStashesOff",
11419+
"when": "false"
11420+
},
1134611421
{
1134711422
"command": "gitlens.views.contributors.copy",
1134811423
"when": "false"
@@ -12239,6 +12314,14 @@
1223912314
"command": "gitlens.views.worktrees.setShowBranchPullRequestOff",
1224012315
"when": "false"
1224112316
},
12317+
{
12318+
"command": "gitlens.views.worktrees.setShowStashesOn",
12319+
"when": "false"
12320+
},
12321+
{
12322+
"command": "gitlens.views.worktrees.setShowStashesOff",
12323+
"when": "false"
12324+
},
1224212325
{
1224312326
"command": "gitlens.graph.switchToEditorLayout",
1224412327
"when": "gitlens:enabled && config.gitlens.graph.layout != editor"
@@ -13272,6 +13355,16 @@
1327213355
"when": "view == gitlens.views.branches && config.gitlens.views.branches.pullRequests.enabled && config.gitlens.views.branches.pullRequests.showForBranches",
1327313356
"group": "5_gitlens@2"
1327413357
},
13358+
{
13359+
"command": "gitlens.views.branches.setShowStashesOn",
13360+
"when": "view == gitlens.views.branches && !config.gitlens.views.branches.showStashes",
13361+
"group": "5_gitlens@11"
13362+
},
13363+
{
13364+
"command": "gitlens.views.branches.setShowStashesOff",
13365+
"when": "view == gitlens.views.branches && config.gitlens.views.branches.showStashes",
13366+
"group": "5_gitlens@11"
13367+
},
1327513368
{
1327613369
"command": "gitlens.pushRepositories",
1327713370
"when": "gitlens:repos:withRemotes && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders && view == gitlens.views.commits",
@@ -13380,7 +13473,17 @@
1338013473
{
1338113474
"command": "gitlens.views.commits.setShowBranchPullRequestOff",
1338213475
"when": "view == gitlens.views.commits && config.gitlens.views.commits.pullRequests.enabled && config.gitlens.views.commits.pullRequests.showForBranches",
13383-
"group": "5_gitlens@4"
13476+
"group": "5_gitlens@3"
13477+
},
13478+
{
13479+
"command": "gitlens.views.commits.setShowStashesOn",
13480+
"when": "view == gitlens.views.commits && !config.gitlens.views.commits.showStashes",
13481+
"group": "5_gitlens@11"
13482+
},
13483+
{
13484+
"command": "gitlens.views.commits.setShowStashesOff",
13485+
"when": "view == gitlens.views.commits && config.gitlens.views.commits.showStashes",
13486+
"group": "5_gitlens@11"
1338413487
},
1338513488
{
1338613489
"command": "gitlens.showGraph",
@@ -14332,15 +14435,25 @@
1433214435
"when": "view == gitlens.views.worktrees && config.gitlens.views.worktrees.pullRequests.enabled && config.gitlens.views.worktrees.pullRequests.showForBranches",
1433314436
"group": "5_gitlens@2"
1433414437
},
14438+
{
14439+
"command": "gitlens.views.worktrees.setShowStashesOn",
14440+
"when": "view == gitlens.views.worktrees && !config.gitlens.views.worktrees.showStashes",
14441+
"group": "5_gitlens@11"
14442+
},
14443+
{
14444+
"command": "gitlens.views.worktrees.setShowStashesOff",
14445+
"when": "view == gitlens.views.worktrees && config.gitlens.views.worktrees.showStashes",
14446+
"group": "5_gitlens@11"
14447+
},
1433514448
{
1433614449
"command": "gitlens.views.setShowRelativeDateMarkersOn",
1433714450
"when": "view =~ /^gitlens\\.views\\.(branches|commits|contributors|fileHistory|lineHistory|remotes|repositories|tags|worktrees)/ && !config.gitlens.views.showRelativeDateMarkers",
14338-
"group": "5_gitlens@3"
14451+
"group": "5_gitlens@10"
1433914452
},
1434014453
{
1434114454
"command": "gitlens.views.setShowRelativeDateMarkersOff",
1434214455
"when": "view =~ /^gitlens\\.views\\.(branches|commits|contributors|fileHistory|lineHistory|remotes|repositories|tags|worktrees)/ && config.gitlens.views.showRelativeDateMarkers",
14343-
"group": "5_gitlens@3"
14456+
"group": "5_gitlens@10"
1434414457
},
1434514458
{
1434614459
"submenu": "gitlens/graph/configuration",
@@ -17799,12 +17912,12 @@
1779917912
{
1780017913
"command": "gitlens.views.setShowRelativeDateMarkersOn",
1780117914
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view =~ /(branches|commits|contributors|remotes|repositories|tags|worktrees)/ && !config.gitlens.views.showRelativeDateMarkers",
17802-
"group": "5_gitlens@3"
17915+
"group": "5_gitlens@10"
1780317916
},
1780417917
{
1780517918
"command": "gitlens.views.setShowRelativeDateMarkersOff",
1780617919
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view =~ /(branches|commits|contributors|remotes|repositories|tags|worktrees)/ && config.gitlens.views.showRelativeDateMarkers",
17807-
"group": "5_gitlens@3"
17920+
"group": "5_gitlens@10"
1780817921
},
1780917922
{
1781017923
"command": "gitlens.views.branches.setLayoutToList",
@@ -17861,6 +17974,16 @@
1786117974
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == branches && config.gitlens.views.branches.pullRequests.enabled && config.gitlens.views.branches.pullRequests.showForBranches",
1786217975
"group": "5_gitlens@2"
1786317976
},
17977+
{
17978+
"command": "gitlens.views.branches.setShowStashesOn",
17979+
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == branches && !config.gitlens.views.branches.showStashes",
17980+
"group": "5_gitlens@11"
17981+
},
17982+
{
17983+
"command": "gitlens.views.branches.setShowStashesOff",
17984+
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == branches && config.gitlens.views.branches.showStashes",
17985+
"group": "5_gitlens@11"
17986+
},
1786417987
{
1786517988
"command": "gitlens.showSettingsPage!branches-view",
1786617989
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == branches",
@@ -17919,7 +18042,17 @@
1791918042
{
1792018043
"command": "gitlens.views.commits.setShowBranchPullRequestOff",
1792118044
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == commits && config.gitlens.views.commits.pullRequests.enabled && config.gitlens.views.commits.pullRequests.showForBranches",
17922-
"group": "5_gitlens@4"
18045+
"group": "5_gitlens@3"
18046+
},
18047+
{
18048+
"command": "gitlens.views.commits.setShowStashesOn",
18049+
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == commits && !config.gitlens.views.commits.showStashes",
18050+
"group": "5_gitlens@11"
18051+
},
18052+
{
18053+
"command": "gitlens.views.commits.setShowStashesOff",
18054+
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == commits && config.gitlens.views.commits.showStashes",
18055+
"group": "5_gitlens@11"
1792318056
},
1792418057
{
1792518058
"command": "gitlens.showSettingsPage!commits-view",
@@ -18241,6 +18374,16 @@
1824118374
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == worktrees && config.gitlens.views.worktrees.pullRequests.enabled && config.gitlens.views.worktrees.pullRequests.showForBranches",
1824218375
"group": "5_gitlens@2"
1824318376
},
18377+
{
18378+
"command": "gitlens.views.worktrees.setShowStashesOn",
18379+
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == worktrees && !config.gitlens.views.worktrees.showStashes",
18380+
"group": "5_gitlens@11"
18381+
},
18382+
{
18383+
"command": "gitlens.views.worktrees.setShowStashesOff",
18384+
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == worktrees && config.gitlens.views.worktrees.showStashes",
18385+
"group": "5_gitlens@11"
18386+
},
1824418387
{
1824518388
"command": "gitlens.showSettingsPage!worktrees-view",
1824618389
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == worktrees",

src/config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,7 @@ export interface BranchesViewConfig {
700700
};
701701
readonly reveal: boolean;
702702
readonly showBranchComparison: false | Extract<ViewShowBranchComparison, 'branch'>;
703+
readonly showStashes: boolean;
703704
}
704705

705706
export interface CommitsViewConfig {
@@ -713,6 +714,7 @@ export interface CommitsViewConfig {
713714
};
714715
readonly reveal: boolean;
715716
readonly showBranchComparison: false | ViewShowBranchComparison;
717+
readonly showStashes: boolean;
716718
}
717719

718720
export interface CommitDetailsViewConfig {
@@ -806,6 +808,7 @@ export interface RepositoriesViewConfig {
806808
readonly branches: {
807809
readonly layout: ViewBranchesLayout;
808810
readonly showBranchComparison: false | Extract<ViewShowBranchComparison, 'branch'>;
811+
readonly showStashes: boolean;
809812
};
810813
readonly compact: boolean;
811814
readonly files: ViewsFilesConfig;
@@ -860,13 +863,15 @@ export interface WorktreesViewConfig {
860863
};
861864
readonly reveal: boolean;
862865
readonly showBranchComparison: false | Extract<ViewShowBranchComparison, 'branch'>;
866+
readonly showStashes: boolean;
863867
}
864868

865869
export interface WorkspacesViewConfig {
866870
readonly avatars: boolean;
867871
readonly branches: {
868872
readonly layout: ViewBranchesLayout;
869873
readonly showBranchComparison: false | Extract<ViewShowBranchComparison, 'branch'>;
874+
readonly showStashes: boolean;
870875
};
871876
readonly compact: boolean;
872877
readonly files: ViewsFilesConfig;

src/constants.commands.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,8 @@ export type TreeViewCommands = `gitlens.views.${
337337
| `setFilesLayoutTo${'Auto' | 'List' | 'Tree'}`
338338
| `setShowAvatars${'On' | 'Off'}`
339339
| `setShowBranchComparison${'On' | 'Off'}`
340-
| `setShowBranchPullRequest${'On' | 'Off'}`}`
340+
| `setShowBranchPullRequest${'On' | 'Off'}`
341+
| `setShowStashes${'On' | 'Off'}`}`
341342
| `commits.${
342343
| 'copy'
343344
| 'refresh'
@@ -346,7 +347,8 @@ export type TreeViewCommands = `gitlens.views.${
346347
| `setShowAvatars${'On' | 'Off'}`
347348
| `setShowBranchComparison${'On' | 'Off'}`
348349
| `setShowBranchPullRequest${'On' | 'Off'}`
349-
| `setShowMergeCommits${'On' | 'Off'}`}`
350+
| `setShowMergeCommits${'On' | 'Off'}`
351+
| `setShowStashes${'On' | 'Off'}`}`
350352
| `contributors.${
351353
| 'copy'
352354
| 'refresh'
@@ -451,7 +453,8 @@ export type TreeViewCommands = `gitlens.views.${
451453
| `setFilesLayoutTo${'Auto' | 'List' | 'Tree'}`
452454
| `setShowAvatars${'On' | 'Off'}`
453455
| `setShowBranchComparison${'On' | 'Off'}`
454-
| `setShowBranchPullRequest${'On' | 'Off'}`}`}`;
456+
| `setShowBranchPullRequest${'On' | 'Off'}`
457+
| `setShowStashes${'On' | 'Off'}`}`}`;
455458

456459
type ExtractSuffix<Prefix extends string, U> = U extends `${Prefix}${infer V}` ? V : never;
457460
type FilterCommands<Prefix extends string, U> = U extends `${Prefix}${infer V}` ? `${Prefix}${V}` : never;

src/env/node/git/git.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,7 @@ export class Git {
15911591
async rev_list(
15921592
repoPath: string,
15931593
ref: string,
1594-
options?: { all?: boolean; maxParents?: number },
1594+
options?: { all?: boolean; maxParents?: number; since?: string },
15951595
): Promise<string[] | undefined> {
15961596
const params = ['rev-list'];
15971597
if (options?.all) {
@@ -1602,6 +1602,10 @@ export class Git {
16021602
params.push(`--max-parents=${options.maxParents}`);
16031603
}
16041604

1605+
if (options?.since) {
1606+
params.push(`--since="${options.since}"`, '--date-order');
1607+
}
1608+
16051609
const rawData = await this.git<string>(
16061610
{ cwd: repoPath, errors: GitErrorHandling.Ignore },
16071611
...params,

0 commit comments

Comments
 (0)