@@ -515,6 +515,48 @@ VALUE rb_merge_file_result_fromC(const git_merge_file_result *result)
515
515
return rb_result ;
516
516
}
517
517
518
+ static VALUE rb_git_path_is_dotgit_modules (VALUE self , VALUE rb_path )
519
+ {
520
+ const char * path ;
521
+ int is_dotgit ;
522
+
523
+ Check_Type (rb_path , T_STRING );
524
+
525
+ path = StringValueCStr (rb_path );
526
+
527
+ is_dotgit = git_path_is_gitfile (path , strlen (path ), GIT_PATH_GITFILE_GITMODULES , GIT_PATH_FS_GENERIC );
528
+
529
+ return is_dotgit ? Qtrue : Qfalse ;
530
+ }
531
+
532
+ static VALUE rb_git_path_is_dotgit_ignore (VALUE self , VALUE rb_path )
533
+ {
534
+ const char * path ;
535
+ int is_dotgit ;
536
+
537
+ Check_Type (rb_path , T_STRING );
538
+
539
+ path = StringValueCStr (rb_path );
540
+
541
+ is_dotgit = git_path_is_gitfile (path , strlen (path ), GIT_PATH_GITFILE_GITIGNORE , GIT_PATH_FS_GENERIC );
542
+
543
+ return is_dotgit ? Qtrue : Qfalse ;
544
+ }
545
+
546
+ static VALUE rb_git_path_is_dotgit_attributes (VALUE self , VALUE rb_path )
547
+ {
548
+ const char * path ;
549
+ int is_dotgit ;
550
+
551
+ Check_Type (rb_path , T_STRING );
552
+
553
+ path = StringValueCStr (rb_path );
554
+
555
+ is_dotgit = git_path_is_gitfile (path , strlen (path ), GIT_PATH_GITFILE_GITATTRIBUTES , GIT_PATH_FS_GENERIC );
556
+
557
+ return is_dotgit ? Qtrue : Qfalse ;
558
+ }
559
+
518
560
void Init_rugged (void )
519
561
{
520
562
rb_mRugged = rb_define_module ("Rugged" );
@@ -544,6 +586,9 @@ void Init_rugged(void)
544
586
rb_define_module_function (rb_mRugged , "prettify_message" , rb_git_prettify_message , -1 );
545
587
rb_define_module_function (rb_mRugged , "__cache_usage__" , rb_git_cache_usage , 0 );
546
588
rb_define_module_function (rb_mRugged , "signature_from_buffer" , rb_git_signature_from_buffer , -1 );
589
+ rb_define_module_function (rb_mRugged , "dotgit_modules?" , rb_git_path_is_dotgit_modules , 1 );
590
+ rb_define_module_function (rb_mRugged , "dotgit_ignore?" , rb_git_path_is_dotgit_ignore , 1 );
591
+ rb_define_module_function (rb_mRugged , "dotgit_attributes?" , rb_git_path_is_dotgit_attributes , 1 );
547
592
548
593
Init_rugged_reference ();
549
594
Init_rugged_reference_collection ();
0 commit comments