@@ -974,6 +974,39 @@ func testAmendInvalidInput(t *testing.T, sync bool) {
974974 })
975975}
976976
977+ func TestSPRFetchOverridesNoFetchConfig (t * testing.T ) {
978+ // Test that --fetch flag overrides noFetch config (sets NoFetch back to false)
979+ // This simulates: yaml has noFetch: true, user passes --fetch on CLI
980+ s , gitmock , githubmock , _ , output := makeTestObjects (t , true )
981+ assert := require .New (t )
982+ ctx := context .Background ()
983+
984+ // Start with NoFetch true (as if loaded from yaml config)
985+ s .config .User .NoFetch = true
986+ // Then override it back to false (as the --fetch flag would do)
987+ s .config .User .NoFetch = false
988+
989+ c1 := git.Commit {
990+ CommitID : "00000001" ,
991+ CommitHash : "c100000000000000000000000000000000000000" ,
992+ Subject : "test commit 1" ,
993+ }
994+
995+ // With NoFetch=false, fetch should run
996+ githubmock .ExpectGetInfo ()
997+ gitmock .ExpectFetch ()
998+ gitmock .ExpectLogAndRespond ([]* git.Commit {& c1 })
999+ gitmock .ExpectPushCommits ([]* git.Commit {& c1 })
1000+ githubmock .ExpectCreatePullRequest (c1 , nil )
1001+ githubmock .ExpectUpdatePullRequest (c1 , nil )
1002+ githubmock .ExpectGetInfo ()
1003+ s .UpdatePullRequests (ctx , nil , nil )
1004+ assert .Equal ("[vvvv] 1 : test commit 1\n " , output .String ())
1005+ gitmock .ExpectationsMet ()
1006+ githubmock .ExpectationsMet ()
1007+ output .Reset ()
1008+ }
1009+
9771010func uintptr (a uint ) * uint {
9781011 return & a
9791012}
0 commit comments