Skip to content

Commit 103d555

Browse files
committed
Adds stashes into Commit view
1 parent 457e86e commit 103d555

File tree

13 files changed

+297
-30
lines changed

13 files changed

+297
-30
lines changed

package.json

Lines changed: 151 additions & 8 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": false,
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",
@@ -2070,7 +2077,7 @@
20702077
},
20712078
"gitlens.views.repositories.showStashes": {
20722079
"type": "boolean",
2073-
"default": true,
2080+
"default": false,
20742081
"markdownDescription": "Specifies whether to show the stashes for each repository in the _Repositories_ view",
20752082
"scope": "window",
20762083
"order": 33
@@ -2192,6 +2199,13 @@
21922199
"scope": "window",
21932200
"order": 90
21942201
},
2202+
"gitlens.views.repositories.branches.showStashes": {
2203+
"type": "boolean",
2204+
"default": false,
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": false,
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": false,
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",
@@ -3229,7 +3257,7 @@
32293257
},
32303258
"gitlens.views.workspaces.showStashes": {
32313259
"type": "boolean",
3232-
"default": true,
3260+
"default": false,
32333261
"markdownDescription": "Specifies whether to show the stashes for each repository in the _Cloud Workspaces_ view",
32343262
"scope": "window",
32353263
"order": 33
@@ -3337,6 +3365,13 @@
33373365
"scope": "window",
33383366
"order": 90
33393367
},
3368+
"gitlens.views.workspaces.branches.showStashes": {
3369+
"type": "boolean",
3370+
"default": false,
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",
@@ -11266,6 +11325,14 @@
1126611325
"command": "gitlens.views.branches.setShowBranchPullRequestOff",
1126711326
"when": "false"
1126811327
},
11328+
{
11329+
"command": "gitlens.views.branches.setShowStashesOn",
11330+
"when": "false"
11331+
},
11332+
{
11333+
"command": "gitlens.views.branches.setShowStashesOff",
11334+
"when": "false"
11335+
},
1126911336
{
1127011337
"command": "gitlens.views.commitDetails.refresh",
1127111338
"when": "false"
@@ -11342,6 +11409,14 @@
1134211409
"command": "gitlens.views.commits.setShowBranchPullRequestOff",
1134311410
"when": "false"
1134411411
},
11412+
{
11413+
"command": "gitlens.views.commits.setShowStashesOn",
11414+
"when": "false"
11415+
},
11416+
{
11417+
"command": "gitlens.views.commits.setShowStashesOff",
11418+
"when": "false"
11419+
},
1134511420
{
1134611421
"command": "gitlens.views.contributors.copy",
1134711422
"when": "false"
@@ -12238,6 +12313,14 @@
1223812313
"command": "gitlens.views.worktrees.setShowBranchPullRequestOff",
1223912314
"when": "false"
1224012315
},
12316+
{
12317+
"command": "gitlens.views.worktrees.setShowStashesOn",
12318+
"when": "false"
12319+
},
12320+
{
12321+
"command": "gitlens.views.worktrees.setShowStashesOff",
12322+
"when": "false"
12323+
},
1224112324
{
1224212325
"command": "gitlens.graph.switchToEditorLayout",
1224312326
"when": "gitlens:enabled && config.gitlens.graph.layout != editor"
@@ -13271,6 +13354,16 @@
1327113354
"when": "view == gitlens.views.branches && config.gitlens.views.branches.pullRequests.enabled && config.gitlens.views.branches.pullRequests.showForBranches",
1327213355
"group": "5_gitlens@2"
1327313356
},
13357+
{
13358+
"command": "gitlens.views.branches.setShowStashesOn",
13359+
"when": "view == gitlens.views.branches && !config.gitlens.views.branches.showStashes",
13360+
"group": "5_gitlens@11"
13361+
},
13362+
{
13363+
"command": "gitlens.views.branches.setShowStashesOff",
13364+
"when": "view == gitlens.views.branches && config.gitlens.views.branches.showStashes",
13365+
"group": "5_gitlens@11"
13366+
},
1327413367
{
1327513368
"command": "gitlens.pushRepositories",
1327613369
"when": "gitlens:repos:withRemotes && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders && view == gitlens.views.commits",
@@ -13379,7 +13472,17 @@
1337913472
{
1338013473
"command": "gitlens.views.commits.setShowBranchPullRequestOff",
1338113474
"when": "view == gitlens.views.commits && config.gitlens.views.commits.pullRequests.enabled && config.gitlens.views.commits.pullRequests.showForBranches",
13382-
"group": "5_gitlens@4"
13475+
"group": "5_gitlens@3"
13476+
},
13477+
{
13478+
"command": "gitlens.views.commits.setShowStashesOn",
13479+
"when": "view == gitlens.views.commits && !config.gitlens.views.commits.showStashes",
13480+
"group": "5_gitlens@11"
13481+
},
13482+
{
13483+
"command": "gitlens.views.commits.setShowStashesOff",
13484+
"when": "view == gitlens.views.commits && config.gitlens.views.commits.showStashes",
13485+
"group": "5_gitlens@11"
1338313486
},
1338413487
{
1338513488
"command": "gitlens.showGraph",
@@ -14331,15 +14434,25 @@
1433114434
"when": "view == gitlens.views.worktrees && config.gitlens.views.worktrees.pullRequests.enabled && config.gitlens.views.worktrees.pullRequests.showForBranches",
1433214435
"group": "5_gitlens@2"
1433314436
},
14437+
{
14438+
"command": "gitlens.views.worktrees.setShowStashesOn",
14439+
"when": "view == gitlens.views.worktrees && !config.gitlens.views.worktrees.showStashes",
14440+
"group": "5_gitlens@11"
14441+
},
14442+
{
14443+
"command": "gitlens.views.worktrees.setShowStashesOff",
14444+
"when": "view == gitlens.views.worktrees && config.gitlens.views.worktrees.showStashes",
14445+
"group": "5_gitlens@11"
14446+
},
1433414447
{
1433514448
"command": "gitlens.views.setShowRelativeDateMarkersOn",
1433614449
"when": "view =~ /^gitlens\\.views\\.(branches|commits|contributors|fileHistory|lineHistory|remotes|repositories|tags|worktrees)/ && !config.gitlens.views.showRelativeDateMarkers",
14337-
"group": "5_gitlens@3"
14450+
"group": "5_gitlens@10"
1433814451
},
1433914452
{
1434014453
"command": "gitlens.views.setShowRelativeDateMarkersOff",
1434114454
"when": "view =~ /^gitlens\\.views\\.(branches|commits|contributors|fileHistory|lineHistory|remotes|repositories|tags|worktrees)/ && config.gitlens.views.showRelativeDateMarkers",
14342-
"group": "5_gitlens@3"
14455+
"group": "5_gitlens@10"
1434314456
},
1434414457
{
1434514458
"submenu": "gitlens/graph/configuration",
@@ -17798,12 +17911,12 @@
1779817911
{
1779917912
"command": "gitlens.views.setShowRelativeDateMarkersOn",
1780017913
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view =~ /(branches|commits|contributors|remotes|repositories|tags|worktrees)/ && !config.gitlens.views.showRelativeDateMarkers",
17801-
"group": "5_gitlens@3"
17914+
"group": "5_gitlens@10"
1780217915
},
1780317916
{
1780417917
"command": "gitlens.views.setShowRelativeDateMarkersOff",
1780517918
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view =~ /(branches|commits|contributors|remotes|repositories|tags|worktrees)/ && config.gitlens.views.showRelativeDateMarkers",
17806-
"group": "5_gitlens@3"
17919+
"group": "5_gitlens@10"
1780717920
},
1780817921
{
1780917922
"command": "gitlens.views.branches.setLayoutToList",
@@ -17860,6 +17973,16 @@
1786017973
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == branches && config.gitlens.views.branches.pullRequests.enabled && config.gitlens.views.branches.pullRequests.showForBranches",
1786117974
"group": "5_gitlens@2"
1786217975
},
17976+
{
17977+
"command": "gitlens.views.branches.setShowStashesOn",
17978+
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == branches && !config.gitlens.views.branches.showStashes",
17979+
"group": "5_gitlens@11"
17980+
},
17981+
{
17982+
"command": "gitlens.views.branches.setShowStashesOff",
17983+
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == branches && config.gitlens.views.branches.showStashes",
17984+
"group": "5_gitlens@11"
17985+
},
1786317986
{
1786417987
"command": "gitlens.showSettingsPage!branches-view",
1786517988
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == branches",
@@ -17918,7 +18041,17 @@
1791818041
{
1791918042
"command": "gitlens.views.commits.setShowBranchPullRequestOff",
1792018043
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == commits && config.gitlens.views.commits.pullRequests.enabled && config.gitlens.views.commits.pullRequests.showForBranches",
17921-
"group": "5_gitlens@4"
18044+
"group": "5_gitlens@3"
18045+
},
18046+
{
18047+
"command": "gitlens.views.commits.setShowStashesOn",
18048+
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == commits && !config.gitlens.views.commits.showStashes",
18049+
"group": "5_gitlens@11"
18050+
},
18051+
{
18052+
"command": "gitlens.views.commits.setShowStashesOff",
18053+
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == commits && config.gitlens.views.commits.showStashes",
18054+
"group": "5_gitlens@11"
1792218055
},
1792318056
{
1792418057
"command": "gitlens.showSettingsPage!commits-view",
@@ -18240,6 +18373,16 @@
1824018373
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == worktrees && config.gitlens.views.worktrees.pullRequests.enabled && config.gitlens.views.worktrees.pullRequests.showForBranches",
1824118374
"group": "5_gitlens@2"
1824218375
},
18376+
{
18377+
"command": "gitlens.views.worktrees.setShowStashesOn",
18378+
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == worktrees && !config.gitlens.views.worktrees.showStashes",
18379+
"group": "5_gitlens@11"
18380+
},
18381+
{
18382+
"command": "gitlens.views.worktrees.setShowStashesOff",
18383+
"when": "view == gitlens.views.scm.grouped && gitlens:views:scm:grouped:view == worktrees && config.gitlens.views.worktrees.showStashes",
18384+
"group": "5_gitlens@11"
18385+
},
1824318386
{
1824418387
"command": "gitlens.showSettingsPage!worktrees-view",
1824518388
"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)