@@ -130,6 +130,19 @@ void test_stash_save__can_keep_index(void)
130130 assert_status (repo , "just.ignore" , GIT_STATUS_IGNORED );
131131}
132132
133+ void test_stash_save__can_keep_all (void )
134+ {
135+ cl_git_pass (git_stash_save (& stash_tip_oid , repo , signature , NULL , GIT_STASH_KEEP_ALL ));
136+
137+ assert_status (repo , "what" , GIT_STATUS_WT_MODIFIED | GIT_STATUS_INDEX_MODIFIED );
138+ assert_status (repo , "how" , GIT_STATUS_INDEX_MODIFIED );
139+ assert_status (repo , "who" , GIT_STATUS_WT_MODIFIED );
140+ assert_status (repo , "when" , GIT_STATUS_WT_NEW );
141+ assert_status (repo , "why" , GIT_STATUS_INDEX_NEW );
142+ assert_status (repo , "where" , GIT_STATUS_WT_MODIFIED | GIT_STATUS_INDEX_NEW );
143+ assert_status (repo , "just.ignore" , GIT_STATUS_IGNORED );
144+ }
145+
133146static void assert_commit_message_contains (const char * revision , const char * fragment )
134147{
135148 git_commit * commit ;
@@ -488,3 +501,27 @@ void test_stash_save__deleted_in_index_modified_in_workdir(void)
488501
489502 git_index_free (index );
490503}
504+
505+ void test_stash_save__option_paths (void )
506+ {
507+ git_stash_save_options options = GIT_STASH_SAVE_OPTIONS_INIT ;
508+ char * paths [2 ] = { "who" , "where" };
509+
510+ options .paths = (git_strarray ){
511+ paths ,
512+ 2
513+ };
514+ options .stasher = signature ;
515+
516+ cl_git_pass (git_stash_save_with_opts (& stash_tip_oid , repo , & options ));
517+
518+ assert_blob_oid ("refs/stash:who" , "a0400d4954659306a976567af43125a0b1aa8595" );
519+ assert_blob_oid ("refs/stash:where" , "e3d6434ec12eb76af8dfa843a64ba6ab91014a0b" );
520+
521+ assert_blob_oid ("refs/stash:what" , "ce013625030ba8dba906f756967f9e9ca394464a" );
522+ assert_blob_oid ("refs/stash:how" , "ac790413e2d7a26c3767e78c57bb28716686eebc" );
523+ assert_blob_oid ("refs/stash:when" , NULL );
524+ assert_blob_oid ("refs/stash:why" , NULL );
525+ assert_blob_oid ("refs/stash:.gitignore" , "ac4d88de61733173d9959e4b77c69b9f17a00980" );
526+ assert_blob_oid ("refs/stash:just.ignore" , NULL );
527+ }
0 commit comments