File tree Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
10
10
## [ Unreleased] - ReleaseDate
11
11
12
+ ### Changed
13
+
14
+ - BREAKING (#1462 ): ` record --stash ` now uses a default message if none are given, instead of prompting for one.
15
+
12
16
## [ v0.10.0] - 2024-10-10
13
17
14
18
### Added
Original file line number Diff line number Diff line change @@ -157,6 +157,11 @@ fn record(
157
157
) ?) ;
158
158
}
159
159
} else {
160
+ let messages = if messages. is_empty ( ) && stash {
161
+ vec ! [ "temp: stash" . to_string( ) ]
162
+ } else {
163
+ messages
164
+ } ;
160
165
let args = {
161
166
let mut args = vec ! [ "commit" ] ;
162
167
args. extend ( messages. iter ( ) . flat_map ( |message| [ "--message" , message] ) ) ;
Original file line number Diff line number Diff line change @@ -342,6 +342,40 @@ 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. commit_file ( "test1" , 1 ) ?;
355
+ git. write_file_txt ( "test1" , "new test1 contents\n " ) ?;
356
+ {
357
+ let ( stdout, _stderr) = git. branchless ( "record" , & [ "--stash" ] ) ?;
358
+ insta:: assert_snapshot!( stdout, @r###"
359
+ [master 78c965b] temp: stash
360
+ 1 file changed, 1 insertion(+), 1 deletion(-)
361
+ branchless: running command: <git-executable> branch -f master 62fc20d2a290daea0d52bdc2ed2ad4be6491010e
362
+ branchless: running command: <git-executable> checkout master
363
+ "### ) ;
364
+ }
365
+
366
+ {
367
+ let stdout = git. smartlog ( ) ?;
368
+ insta:: assert_snapshot!( stdout, @r###"
369
+ :
370
+ @ 62fc20d (> master) create test1.txt
371
+ |
372
+ o 78c965b temp: stash
373
+ "### ) ;
374
+ }
375
+
376
+ Ok ( ( ) )
377
+ }
378
+
345
379
#[ test]
346
380
fn test_record_create_branch ( ) -> eyre:: Result < ( ) > {
347
381
let git = make_git ( ) ?;
You can’t perform that action at this time.
0 commit comments