git-ps-rs
git-ps-rs copied to clipboard
Double `//` in path in warning for isolate_post_checkout executable check
I was setting up a isolate_post_checkout but I didn't mark it is executable. The warning was helpful but it looks like the path has a double //
.
/home/ali/dune//.git/git-ps/hooks/isolate_post_checkout
but it is NOT executable. Due to this the hook is being skipped. Generally
this can be corrected with the following.
chmod u+x /home/ali/dune//.git/git-ps/hooks/isolate_post_checkout
Specifically from line 12 of ps/private/hooks.rs
, we have:
pub fn find_hook(repo_root: &str, filename: &str) -> Result<PathBuf, FindHookError> {
let communal_repository_level_hook_path_string = format!("{}/.git-ps/hooks/{}", repo_root, filename);
let communal_repository_level_hook_path = Path::new(communal_repository_level_hook_path_string.as_str());
let repository_level_hook_path_string = format!("{}/.git/git-ps/hooks/{}", repo_root, filename);
let repository_level_hook_path = Path::new(repository_level_hook_path_string.as_str());
let user_level_hook_path_string = format!("~/.config/git-ps/hooks/{}", filename);
let user_level_hook_path = Path::new(user_level_hook_path_string.as_str()).expand_home().map_err(FindHookError::PathExpandHomeFailed)?;
match path_exists_and_is_executable(communal_repository_level_hook_path) {
The path concatenation here seems a bit crude. There ought to be a better way to do this which makes sure /
is not repeated.
I would agree this could & should probably be done better probably with use of the Path
type or something along those lines.
This has been integrated. Therefore I am closing this issue.