@@ -342,6 +342,74 @@ fn test_record_stash() -> eyre::Result<()> {
342
342
Ok ( ( ) )
343
343
}
344
344
345
+ #[ test]
346
+ fn test_record_stash_default_message ( ) -> eyre:: Result < ( ) > {
347
+ let git = make_git ( ) ?;
348
+
349
+ if !git. supports_reference_transactions ( ) ? {
350
+ return Ok ( ( ) ) ;
351
+ }
352
+ git. init_repo ( ) ?;
353
+
354
+ git. run ( & [ "config" , "branchless.record.interactiveStash" , "false" ] ) ?;
355
+
356
+ git. commit_file ( "test1" , 1 ) ?;
357
+
358
+ {
359
+ git. write_file_txt ( "test1" , "new test1 contents\n " ) ?;
360
+
361
+ let ( stdout, _stderr) = git. branchless ( "record" , & [ "--stash" ] ) ?;
362
+ insta:: assert_snapshot!( stdout, @r###"
363
+ [master 78c965b] temp: stash
364
+ 1 file changed, 1 insertion(+), 1 deletion(-)
365
+ branchless: running command: <git-executable> branch -f master 62fc20d2a290daea0d52bdc2ed2ad4be6491010e
366
+ branchless: running command: <git-executable> checkout master
367
+ "### ) ;
368
+ }
369
+
370
+ {
371
+ let stdout = git. smartlog ( ) ?;
372
+ insta:: assert_snapshot!( stdout, @r###"
373
+ :
374
+ @ 62fc20d (> master) create test1.txt
375
+ |
376
+ o 78c965b temp: stash
377
+ "### ) ;
378
+ }
379
+
380
+ {
381
+ git. run ( & [
382
+ "config" ,
383
+ "branchless.record.defautStashMessage" ,
384
+ "foo(bar)!: baz" ,
385
+ ] ) ?;
386
+
387
+ git. write_file_txt ( "test1" , "more new test1 contents\n " ) ?;
388
+
389
+ let ( stdout, _stderr) = git. branchless ( "record" , & [ "--stash" ] ) ?;
390
+ insta:: assert_snapshot!( stdout, @r###"
391
+ [master e574dfa] foo(bar)!: baz
392
+ 1 file changed, 1 insertion(+), 1 deletion(-)
393
+ branchless: running command: <git-executable> branch -f master 62fc20d2a290daea0d52bdc2ed2ad4be6491010e
394
+ branchless: running command: <git-executable> checkout master
395
+ "### ) ;
396
+ }
397
+
398
+ {
399
+ let stdout = git. smartlog ( ) ?;
400
+ insta:: assert_snapshot!( stdout, @r###"
401
+ :
402
+ @ 62fc20d (> master) create test1.txt
403
+ |\
404
+ | o 78c965b temp: stash
405
+ |
406
+ o e574dfa foo(bar)!: baz
407
+ "### ) ;
408
+ }
409
+
410
+ Ok ( ( ) )
411
+ }
412
+
345
413
#[ test]
346
414
fn test_record_create_branch ( ) -> eyre:: Result < ( ) > {
347
415
let git = make_git ( ) ?;
0 commit comments