Skip to content
Snippets Groups Projects
  • Jonas Gorski's avatar
    c4c9f613
    prereq: merge common cases in SetupHostCommand · c4c9f613
    Jonas Gorski authored
    
    Now that most cases do the same thing in SetupHostCommand, merge them
    together into one. To allow moving the generic symlink check, invert the
    check and let it check for relative links by matching on link targets
    that do not start with a slash.
    
    This then allows us to also drop the absolute link case, shortening the
    case statement further.
    
    This reorders the check to
    
    * if it is not a symlink, do not change it
    * if it is a symlink and it points to the found command, do not change it
    * if it is a symlink with a relative path, do not change it
    * else, update/replace it
    
    Signed-off-by: default avatarJonas Gorski <jonas.gorski@gmail.com>
    (cherry picked from commit 3210aa8e0a113cc4354628b08b608c5c8f792941)
    c4c9f613
    History
    prereq: merge common cases in SetupHostCommand
    Jonas Gorski authored
    
    Now that most cases do the same thing in SetupHostCommand, merge them
    together into one. To allow moving the generic symlink check, invert the
    check and let it check for relative links by matching on link targets
    that do not start with a slash.
    
    This then allows us to also drop the absolute link case, shortening the
    case statement further.
    
    This reorders the check to
    
    * if it is not a symlink, do not change it
    * if it is a symlink and it points to the found command, do not change it
    * if it is a symlink with a relative path, do not change it
    * else, update/replace it
    
    Signed-off-by: default avatarJonas Gorski <jonas.gorski@gmail.com>
    (cherry picked from commit 3210aa8e0a113cc4354628b08b608c5c8f792941)