Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

vcs_info: quoting (backticks) in git_patches_applied



I've noticed that there is a problem when using `%m` in vcs_info,
where the default `get-applied-string` hook returns something with
backticks in it:

> 6410ed117e51a4288d06132d18e2ffdf33f51313 Add snippets `'`, `"` and `doc`

While the backticks can be replaced in the prompt itself, it might be
better to quote it in `VCS_INFO_git_handle_patches`:

    diff --git i/Functions/VCS_Info/Backends/VCS_INFO_get_data_git w/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
    index ee50be6..371e935 100644
    --- i/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
    +++ w/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
    @@ -121,7 +121,7 @@ VCS_INFO_git_handle_patches () {

         if VCS_INFO_hook 'gen-applied-string' "${git_patches_applied[@]}"; then
             if (( ${#git_patches_applied} )); then
    -            git_applied_s=${git_patches_applied[1]}
    +            git_applied_s=${(qqq)git_patches_applied[1]}
             else
                 git_applied_s=""
             fi

There is probably a better place to apply the quoting, e.g. when reading
the patches from the file, or a more central place in vcs_info, because
this is likely to affect other backends, too.


Regards,
Daniel.



Messages sorted by: Reverse Date, Date, Thread, Author