Class UrlConfig


  • public class UrlConfig
    extends Object
    Support for URL translations via git configs url.<base>.insteadOf and url.<base>.pushInsteadOf.
    Since:
    6.2
    • Constructor Detail

      • UrlConfig

        public UrlConfig​(Config config)
        Creates a new UrlConfig instance.
        Parameters:
        config - Config to read values from
    • Method Detail

      • replace

        public String replace​(String url)
        Performs replacements as defined by git config url.<base>.insteadOf. If there is no match, the input is returned unchanged.
        Parameters:
        url - to substitute
        Returns:
        the url with substitution applied
      • hasPushReplacements

        public boolean hasPushReplacements()
        Tells whether there are push replacements.
        Returns:
        true if there are push replacements, false otherwise
      • replacePush

        public String replacePush​(String url)
        Performs replacements as defined by git config url.<base>.pushInsteadOf. If there is no match, the input is returned unchanged.
        Parameters:
        url - to substitute
        Returns:
        the url with substitution applied