@@ -69,6 +69,13 @@ describe("when: branch is clean and has an open PR", () => {
6969 kind : "open_dialog" ,
7070 dialogAction : "commit" ,
7171 } ,
72+ {
73+ id : "pull" ,
74+ label : "Pull" ,
75+ disabled : true ,
76+ icon : "pull" ,
77+ kind : "run_pull" ,
78+ } ,
7279 {
7380 id : "push" ,
7481 label : "Push" ,
@@ -110,6 +117,13 @@ describe("when: actions are busy", () => {
110117 kind : "open_dialog" ,
111118 dialogAction : "commit" ,
112119 } ,
120+ {
121+ id : "pull" ,
122+ label : "Pull" ,
123+ disabled : true ,
124+ icon : "pull" ,
125+ kind : "run_pull" ,
126+ } ,
113127 {
114128 id : "push" ,
115129 label : "Push" ,
@@ -190,6 +204,13 @@ describe("when: branch is clean, ahead, and has an open PR", () => {
190204 kind : "open_dialog" ,
191205 dialogAction : "commit" ,
192206 } ,
207+ {
208+ id : "pull" ,
209+ label : "Pull" ,
210+ disabled : true ,
211+ icon : "pull" ,
212+ kind : "run_pull" ,
213+ } ,
193214 {
194215 id : "push" ,
195216 label : "Push" ,
@@ -230,6 +251,13 @@ describe("when: branch is clean, ahead, and has no open PR", () => {
230251 kind : "open_dialog" ,
231252 dialogAction : "commit" ,
232253 } ,
254+ {
255+ id : "pull" ,
256+ label : "Pull" ,
257+ disabled : true ,
258+ icon : "pull" ,
259+ kind : "run_pull" ,
260+ } ,
233261 {
234262 id : "push" ,
235263 label : "Push" ,
@@ -270,6 +298,13 @@ describe("when: branch is clean, up to date, and has no open PR", () => {
270298 kind : "open_dialog" ,
271299 dialogAction : "commit" ,
272300 } ,
301+ {
302+ id : "pull" ,
303+ label : "Pull" ,
304+ disabled : true ,
305+ icon : "pull" ,
306+ kind : "run_pull" ,
307+ } ,
273308 {
274309 id : "push" ,
275310 label : "Push" ,
@@ -296,7 +331,7 @@ describe("when: branch is behind upstream", () => {
296331 assert . deepInclude ( quick , { kind : "run_pull" , label : "Pull" , disabled : false } ) ;
297332 } ) ;
298333
299- it ( "buildMenuItems disables push and create PR" , ( ) => {
334+ it ( "buildMenuItems enables pull and disables push and create PR" , ( ) => {
300335 const items = buildMenuItems ( status ( { behindCount : 1 , pr : null } ) , false ) ;
301336 assert . deepEqual ( items , [
302337 {
@@ -307,6 +342,13 @@ describe("when: branch is behind upstream", () => {
307342 kind : "open_dialog" ,
308343 dialogAction : "commit" ,
309344 } ,
345+ {
346+ id : "pull" ,
347+ label : "Pull" ,
348+ disabled : false ,
349+ icon : "pull" ,
350+ kind : "run_pull" ,
351+ } ,
310352 {
311353 id : "push" ,
312354 label : "Push" ,
@@ -328,13 +370,12 @@ describe("when: branch is behind upstream", () => {
328370} ) ;
329371
330372describe ( "when: branch has diverged from upstream" , ( ) => {
331- it ( "resolveQuickAction returns a disabled sync hint " , ( ) => {
373+ it ( "resolveQuickAction enables sync when working tree is clean " , ( ) => {
332374 const quick = resolveQuickAction ( status ( { aheadCount : 2 , behindCount : 1 } ) , false ) ;
333375 assert . deepEqual ( quick , {
334376 label : "Sync branch" ,
335- disabled : true ,
336- kind : "show_hint" ,
337- hint : "Branch has diverged from upstream. Rebase/merge first." ,
377+ disabled : false ,
378+ kind : "run_pull" ,
338379 } ) ;
339380 } ) ;
340381} ) ;
@@ -397,6 +438,13 @@ describe("when: working tree has local changes", () => {
397438 kind : "open_dialog" ,
398439 dialogAction : "commit" ,
399440 } ,
441+ {
442+ id : "pull" ,
443+ label : "Pull" ,
444+ disabled : true ,
445+ icon : "pull" ,
446+ kind : "run_pull" ,
447+ } ,
400448 {
401449 id : "push" ,
402450 label : "Push" ,
@@ -471,6 +519,13 @@ describe("when: working tree has local changes and branch is behind upstream", (
471519 kind : "open_dialog" ,
472520 dialogAction : "commit" ,
473521 } ,
522+ {
523+ id : "pull" ,
524+ label : "Pull" ,
525+ disabled : false ,
526+ icon : "pull" ,
527+ kind : "run_pull" ,
528+ } ,
474529 {
475530 id : "push" ,
476531 label : "Push" ,
@@ -500,7 +555,7 @@ describe("when: HEAD is detached and there are no local changes", () => {
500555 assert . deepInclude ( quick , { kind : "show_hint" , label : "Commit" , disabled : true } ) ;
501556 } ) ;
502557
503- it ( "buildMenuItems keeps commit, push, and PR disabled" , ( ) => {
558+ it ( "buildMenuItems keeps commit, pull, push, and PR disabled" , ( ) => {
504559 const items = buildMenuItems ( status ( { branch : null , hasWorkingTreeChanges : false } ) , false ) ;
505560 assert . deepEqual ( items , [
506561 {
@@ -511,6 +566,13 @@ describe("when: HEAD is detached and there are no local changes", () => {
511566 kind : "open_dialog" ,
512567 dialogAction : "commit" ,
513568 } ,
569+ {
570+ id : "pull" ,
571+ label : "Pull" ,
572+ disabled : true ,
573+ icon : "pull" ,
574+ kind : "run_pull" ,
575+ } ,
514576 {
515577 id : "push" ,
516578 label : "Push" ,
@@ -603,6 +665,13 @@ describe("when: branch has no upstream configured", () => {
603665 kind : "open_dialog" ,
604666 dialogAction : "commit" ,
605667 } ,
668+ {
669+ id : "pull" ,
670+ label : "Pull" ,
671+ disabled : true ,
672+ icon : "pull" ,
673+ kind : "run_pull" ,
674+ } ,
606675 {
607676 id : "push" ,
608677 label : "Push" ,
@@ -669,6 +738,13 @@ describe("when: branch has no upstream configured", () => {
669738 kind : "open_dialog" ,
670739 dialogAction : "commit" ,
671740 } ,
741+ {
742+ id : "pull" ,
743+ label : "Pull" ,
744+ disabled : true ,
745+ icon : "pull" ,
746+ kind : "run_pull" ,
747+ } ,
672748 {
673749 id : "push" ,
674750 label : "Push" ,
@@ -703,6 +779,13 @@ describe("when: branch has no upstream configured", () => {
703779 kind : "open_dialog" ,
704780 dialogAction : "commit" ,
705781 } ,
782+ {
783+ id : "pull" ,
784+ label : "Pull" ,
785+ disabled : true ,
786+ icon : "pull" ,
787+ kind : "run_pull" ,
788+ } ,
706789 {
707790 id : "push" ,
708791 label : "Push" ,
@@ -779,6 +862,13 @@ describe("when: branch has no upstream configured", () => {
779862 kind : "open_dialog" ,
780863 dialogAction : "commit" ,
781864 } ,
865+ {
866+ id : "pull" ,
867+ label : "Pull" ,
868+ disabled : true ,
869+ icon : "pull" ,
870+ kind : "run_pull" ,
871+ } ,
782872 {
783873 id : "push" ,
784874 label : "Push" ,
0 commit comments