@@ -30,24 +30,24 @@ pub mod versioned {
3030 /// The branch to clone; defaults to `main`.
3131 ///
3232 /// Since git-sync v4.x.x this field is mapped to the flag `--ref`.
33- #[ serde( default = "v1alpha2::GitSync:: default_branch" ) ]
33+ #[ serde( default = "default_branch" ) ]
3434 pub branch : String ,
3535
3636 /// Location in the Git repository containing the resource; defaults to the root folder.
3737 ///
3838 /// It can optionally start with `/`, however, no trailing slash is recommended.
3939 /// An empty string (``) or slash (`/`) corresponds to the root folder in Git.
40- #[ serde( default = "v1alpha2::GitSync:: default_git_folder" ) ]
40+ #[ serde( default = "default_git_folder" ) ]
4141 pub git_folder : PathBuf ,
4242
4343 /// The depth of syncing, i.e. the number of commits to clone; defaults to 1.
44- #[ serde( default = "v1alpha2::GitSync:: default_depth" ) ]
44+ #[ serde( default = "default_depth" ) ]
4545 pub depth : u32 ,
4646
4747 /// The synchronization interval, e.g. `20s` or `5m`; defaults to `20s`.
4848 ///
4949 /// Since git-sync v4.x.x this field is mapped to the flag `--period`.
50- #[ serde( default = "v1alpha2::GitSync:: default_wait" ) ]
50+ #[ serde( default = "default_wait" ) ]
5151 pub wait : Duration ,
5252
5353 /// A map of optional configuration settings that are listed in the git-sync [documentation].
@@ -91,6 +91,22 @@ pub mod versioned {
9191 }
9292}
9393
94+ pub ( crate ) fn default_branch ( ) -> String {
95+ "main" . to_string ( )
96+ }
97+
98+ pub ( crate ) fn default_git_folder ( ) -> PathBuf {
99+ PathBuf :: from ( "/" )
100+ }
101+
102+ pub ( crate ) fn default_depth ( ) -> u32 {
103+ 1
104+ }
105+
106+ pub ( crate ) fn default_wait ( ) -> Duration {
107+ Duration :: from_secs ( 20 )
108+ }
109+
94110pub fn credentials_to_secret ( input : Option < Credentials > ) -> Option < String > {
95111 if let Some ( Credentials :: BasicAuthSecretName ( credentials_secret) ) = input {
96112 Some ( credentials_secret)
0 commit comments