Class CloneUrlIdentity

java.lang.Object
io.github.intisy.gradle.github.utils.CloneUrlIdentity

public final class CloneUrlIdentity extends Object
Derives an owner/repo-shaped identity from an arbitrary git clone URL, for use as a cache-directory or cached-jar-file naming key only; never used to construct the actual clone URL.
Implementation Note:
owner carries a hash of the full URL (the same technique UrlDownloads uses for its download cache key), so two different hosts, or two different credentials on the same host, that happen to share an owner/repo-shaped path never derive the same identity: a git-existence check on a checkout directory has no way to compare its origin remote back against the URL that was requested. The URL is redacted before any segment of it becomes part of the identity, so a credential embedded in it (userinfo, a query token) can never land in a directory or file name; each segment is further sanitized against characters a filesystem path cannot contain (a raw host:port embeds a :, which also breaks mkdirs confusingly on Windows).
  • Method Details

    • derive

      public static String[] derive(String cloneUrl)
      Parameters:
      cloneUrl - the URL to derive an identity from.
      Returns:
      a two-element array, {owner, repo}.