Skip to content

Commit

Permalink
Add config level for worktrees
Browse files Browse the repository at this point in the history
Use the new support in libgit2 for the worktree-config extension.[1]

[1]: https://git-scm.com/docs/git-worktree/2.35.1#_configuration_file
  • Loading branch information
vermiculus committed Feb 24, 2024
1 parent 3da58f3 commit 99787c0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libgit2-sys/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,8 @@ git_enum! {
GIT_CONFIG_LEVEL_XDG = 3,
GIT_CONFIG_LEVEL_GLOBAL = 4,
GIT_CONFIG_LEVEL_LOCAL = 5,
GIT_CONFIG_LEVEL_APP = 6,
GIT_CONFIG_LEVEL_WORKTREE = 6,
GIT_CONFIG_LEVEL_APP = 7,
GIT_CONFIG_HIGHEST_LEVEL = -1,
}
}
Expand Down
1 change: 1 addition & 0 deletions src/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ mod impls {
ConfigLevel::XDG => raw::GIT_CONFIG_LEVEL_XDG,
ConfigLevel::Global => raw::GIT_CONFIG_LEVEL_GLOBAL,
ConfigLevel::Local => raw::GIT_CONFIG_LEVEL_LOCAL,
ConfigLevel::Worktree => raw::GIT_CONFIG_LEVEL_WORKTREE,
ConfigLevel::App => raw::GIT_CONFIG_LEVEL_APP,
ConfigLevel::Highest => raw::GIT_CONFIG_HIGHEST_LEVEL,
}
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ pub enum ConfigLevel {
Global,
/// Repository specific config, e.g. $PWD/.git/config
Local,
/// Worktree-specific config, e.g. $GIT_DIR/config.worktree
Worktree,
/// Application specific configuration file
App,
/// Highest level available
Expand Down Expand Up @@ -963,6 +965,7 @@ impl ConfigLevel {
raw::GIT_CONFIG_LEVEL_XDG => ConfigLevel::XDG,
raw::GIT_CONFIG_LEVEL_GLOBAL => ConfigLevel::Global,
raw::GIT_CONFIG_LEVEL_LOCAL => ConfigLevel::Local,
raw::GIT_CONFIG_LEVEL_WORKTREE => ConfigLevel::Worktree,
raw::GIT_CONFIG_LEVEL_APP => ConfigLevel::App,
raw::GIT_CONFIG_HIGHEST_LEVEL => ConfigLevel::Highest,
n => panic!("unknown config level: {}", n),
Expand Down

0 comments on commit 99787c0

Please sign in to comment.