@@ -113,13 +113,9 @@ fn test_submit() -> eyre::Result<()> {
113113 {
114114 let ( stdout, stderr) = cloned_repo. run ( & [ "submit" , "--create" ] ) ?;
115115 let stderr = redact_remotes ( stderr) ;
116- insta:: assert_snapshot!( stderr, @r###"
117- branchless: processing 1 update: remote branch origin/qux
118- Everything up-to-date
119- "### ) ;
116+ insta:: assert_snapshot!( stderr, @"" ) ;
120117 insta:: assert_snapshot!( stdout, @r###"
121118 branchless: running command: <git-executable> fetch origin
122- branchless: running command: <git-executable> push --force-with-lease origin
123119 Skipped 2 branches (already up-to-date): bar, qux
124120 "### ) ;
125121 }
@@ -240,3 +236,59 @@ fn test_submit_existing_branch() -> eyre::Result<()> {
240236
241237 Ok ( ( ) )
242238}
239+
240+ #[ test]
241+ fn test_submit_up_to_date_branch ( ) -> eyre:: Result < ( ) > {
242+ let GitWrapperWithRemoteRepo {
243+ temp_dir : _guard,
244+ original_repo,
245+ cloned_repo,
246+ } = make_git_with_remote_repo ( ) ?;
247+
248+ if original_repo. get_version ( ) ? < MIN_VERSION {
249+ return Ok ( ( ) ) ;
250+ }
251+
252+ {
253+ original_repo. init_repo ( ) ?;
254+ original_repo. commit_file ( "test1" , 1 ) ?;
255+ original_repo. commit_file ( "test2" , 2 ) ?;
256+ original_repo. clone_repo_into ( & cloned_repo, & [ ] ) ?;
257+ cloned_repo. init_repo_with_options ( & GitInitOptions {
258+ make_initial_commit : false ,
259+ ..Default :: default ( )
260+ } ) ?;
261+ }
262+
263+ cloned_repo. run ( & [ "checkout" , "-b" , "feature" ] ) ?;
264+ cloned_repo. commit_file ( "test3" , 3 ) ?;
265+
266+ {
267+ let ( stdout, stderr) = cloned_repo. run ( & [ "submit" , "--create" , "feature" ] ) ?;
268+ let stderr = redact_remotes ( stderr) ;
269+ insta:: assert_snapshot!( stderr, @r###"
270+ branchless: processing 1 update: branch feature
271+ To: file://<remote>
272+ * [new branch] feature -> feature
273+ branchless: processing 1 update: remote branch origin/feature
274+ "### ) ;
275+ insta:: assert_snapshot!( stdout, @r###"
276+ branchless: running command: <git-executable> push --set-upstream origin feature
277+ branch 'feature' set up to track 'origin/feature'.
278+ Created 1 branch: feature
279+ "### ) ;
280+ }
281+
282+ cloned_repo. detach_head ( ) ?;
283+ {
284+ let ( stdout, stderr) = cloned_repo. run ( & [ "submit" , "feature" ] ) ?;
285+ let stderr = redact_remotes ( stderr) ;
286+ insta:: assert_snapshot!( stderr, @"" ) ;
287+ insta:: assert_snapshot!( stdout, @r###"
288+ branchless: running command: <git-executable> fetch origin
289+ Skipped 1 branch (already up-to-date): feature
290+ "### ) ;
291+ }
292+
293+ Ok ( ( ) )
294+ }
0 commit comments