File tree Expand file tree Collapse file tree 5 files changed +18
-2
lines changed Expand file tree Collapse file tree 5 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -200,6 +200,8 @@ git_enum! {
200200 GIT_EOWNER = -36 ,
201201 GIT_TIMEOUT = -37 ,
202202 GIT_EUNCHANGED = -38 ,
203+ GIT_ENOTSUPPORTED = -39 ,
204+ GIT_EREADONLY = -40 ,
203205 }
204206}
205207
@@ -878,7 +880,8 @@ git_enum! {
878880 GIT_CONFIG_LEVEL_XDG = 3 ,
879881 GIT_CONFIG_LEVEL_GLOBAL = 4 ,
880882 GIT_CONFIG_LEVEL_LOCAL = 5 ,
881- GIT_CONFIG_LEVEL_APP = 6 ,
883+ GIT_CONFIG_LEVEL_WORKTREE = 6 ,
884+ GIT_CONFIG_LEVEL_APP = 7 ,
882885 GIT_CONFIG_HIGHEST_LEVEL = -1 ,
883886 }
884887}
@@ -1974,6 +1977,7 @@ git_enum! {
19741977pub struct git_worktree_add_options {
19751978 pub version : c_uint ,
19761979 pub lock : c_int ,
1980+ pub checkout_existing : c_int ,
19771981 pub reference : * mut git_reference ,
19781982 pub checkout_options : git_checkout_options ,
19791983}
Original file line number Diff line number Diff line change @@ -166,6 +166,7 @@ mod impls {
166166 ConfigLevel :: XDG => raw:: GIT_CONFIG_LEVEL_XDG ,
167167 ConfigLevel :: Global => raw:: GIT_CONFIG_LEVEL_GLOBAL ,
168168 ConfigLevel :: Local => raw:: GIT_CONFIG_LEVEL_LOCAL ,
169+ ConfigLevel :: Worktree => raw:: GIT_CONFIG_LEVEL_WORKTREE ,
169170 ConfigLevel :: App => raw:: GIT_CONFIG_LEVEL_APP ,
170171 ConfigLevel :: Highest => raw:: GIT_CONFIG_HIGHEST_LEVEL ,
171172 }
Original file line number Diff line number Diff line change @@ -385,6 +385,8 @@ pub enum ConfigLevel {
385385 Global ,
386386 /// Repository specific config, e.g. $PWD/.git/config
387387 Local ,
388+ /// Worktree specific configuration file, e.g. $GIT_DIR/config.worktree
389+ Worktree ,
388390 /// Application specific configuration file
389391 App ,
390392 /// Highest level available
@@ -974,6 +976,7 @@ impl ConfigLevel {
974976 raw:: GIT_CONFIG_LEVEL_XDG => ConfigLevel :: XDG ,
975977 raw:: GIT_CONFIG_LEVEL_GLOBAL => ConfigLevel :: Global ,
976978 raw:: GIT_CONFIG_LEVEL_LOCAL => ConfigLevel :: Local ,
979+ raw:: GIT_CONFIG_LEVEL_WORKTREE => ConfigLevel :: Worktree ,
977980 raw:: GIT_CONFIG_LEVEL_APP => ConfigLevel :: App ,
978981 raw:: GIT_CONFIG_HIGHEST_LEVEL => ConfigLevel :: Highest ,
979982 n => panic ! ( "unknown config level: {}" , n) ,
Original file line number Diff line number Diff line change @@ -165,6 +165,12 @@ impl<'a> WorktreeAddOptions<'a> {
165165 self
166166 }
167167
168+ /// If enabled, this will checkout the existing branch matching the worktree name.
169+ pub fn checkout_existing ( & mut self , enabled : bool ) -> & mut WorktreeAddOptions < ' a > {
170+ self . raw . checkout_existing = enabled as c_int ;
171+ self
172+ }
173+
168174 /// reference to use for the new worktree HEAD
169175 pub fn reference (
170176 & mut self ,
Original file line number Diff line number Diff line change @@ -25,7 +25,9 @@ fn main() {
2525 // this field is marked as const which ctest complains about
2626 ( struct_ == "git_rebase_operation" && f == "id" ) ||
2727 // the real name of this field is ref but that is a reserved keyword
28- ( struct_ == "git_worktree_add_options" && f == "reference" )
28+ ( struct_ == "git_worktree_add_options" && f == "reference" ) ||
29+ // the `update_flags` field consists of 2 bitfields
30+ ( struct_ == "git_fetch_options" && f == "update_flags" )
2931 } ) ;
3032 cfg. skip_signededness ( |s| match s {
3133 s if s. ends_with ( "_cb" ) => true ,
You can’t perform that action at this time.
0 commit comments